commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Pettiss <jpett...@yahoo.com>
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...
</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

Mime
View raw message