commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: [DBUtils] newbie qs
Date Sat, 24 Apr 2004 02:58:13 GMT
Jaime Garza wrote:

>I have used a combination of commons DBCP and commons pool before.  Here
>is an example, with a different driver...
>GenericObjectPool connectionPool = new GenericObjectPool(null);
>DriverManagerConnectionFactory connectionFactory = new
>DriverManagerConnectionFactory("jdbc:hsqldb:data/generation", "sa", "");
>PoolableConnectionFactory poolableConnectionFactory = new
>PoolableConnectionFactory(connectionFactory, connectionPool,
>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 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message