You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jason Pettiss <jp...@yahoo.com> on 2003/03/23 00:20:30 UTC

[DBCP] Tomcat & PreparedStatement Pooling

Using Tomcat 4.1.18 container managed pooled connections, by placing the
following in my Context in server.xml:

<Resource name="jdbc/mydb" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/mydb">
...config here...
</ResourceParams>

As I understand it this results in a BasicDataSource being created and used to
implement the pool.  Works like a charm, btw.  ;-)

I'm pretty sure the PoolableConnections returned from this data source do not
by default pool prepared statements.  On looking further I see that there is
definitely at least planned support for doing so (PoolingConnection &
PoolablePreparedStatement), but it doesn't look like the BasicDataSource Tomcat
creates right now will do the job:

BasicDataSource.java, r1.12
        // Set up the poolable connection factory we will use
        PoolableConnectionFactory connectionFactory = null;
        try {
            connectionFactory =
                new PoolableConnectionFactory(driverConnectionFactory,
                                              connectionPool,
                                              null, // FIXME - stmtPoolFactory?

So my question-- is this functionality planned for BasicDataSource, will I need
to manually write my own object factory to dispense PooledConnections, or is
there some JNDI configuration which will get Tomcat to handle all this for me?

Thanks,
Jason Pettiss
jpettiss@yahoo.com


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com