Jaime Garza wrote:

I have used a combination of commons DBCP and commons pool before.  Here
is an example, with a different driver...

Class.forName("org.hsqldb.jdbcDriver");
GenericObjectPool connectionPool = new GenericObjectPool(null);
DriverManagerConnectionFactory connectionFactory = new
DriverManagerConnectionFactory("jdbc:hsqldb:data/generation", "sa", "");
PoolableConnectionFactory poolableConnectionFactory = new
PoolableConnectionFactory(connectionFactory, connectionPool,
null,null,false,true);
DataSource dataSource = new PoolingDataSource(connectionPool);


Code like the above certainly works, but might be considered by some to be too complex. An alternative to consider would be to use the org.apache.commons.dbcp.BasicDataSource class, which is configured very simply via JavaBeans properties. The Javadocs for this class document all the settings.

FYI, this is what Tomcat uses under the covers to provide connection pooling.

Craig




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to