commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Pettiss <>
Subject [DBCP] Tomcat & PreparedStatement Pooling
Date Sat, 22 Mar 2003 23:20:30 GMT
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...

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:, r1.12
        // Set up the poolable connection factory we will use
        PoolableConnectionFactory connectionFactory = null;
        try {
            connectionFactory =
                new PoolableConnectionFactory(driverConnectionFactory,
                                              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?

Jason Pettiss

Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

View raw message