I've heard mixed reviews about the Jakarta Commons Pool and DBCP. The Hibernate forum guys said they may deprecate support for it in a future release of Hibernate. I would take a look at xapool or c-jdbc. c-jdbc does a lot more and is more difficult to setup, but seams to be quite powerful. Here is the link and sample spring definition for xapool. I based it on the JDBC connection example, linked off their homepage.
http://xapool.experlog.com/
Code:
<bean id="dataSource" class="org.enhydra.jdbc.pool.StandardPoolDataSource" destroy-method="stopPool">
<constructor-arg index="0">
<bean class="org.enhydra.jdbc.standard.StandardConnectionPoolDataSource">
<property name="driverName"><value>com.mysql.jdbc.Driver</value></property>
<property name="url"><value>jdbc:mysql://localhost/dbname</value></property>
</bean>
</constructor-arg>
<property name="user"><value>root</value></property>
<property name="password"><value>mypass</value></property>
<property name="minSize"><value>1</value></property>
<property name="maxSize"><value>5</value></property>
<property name="jdbcTestStmt"><value>select 1</value></property>
</bean>
The Spring bean for c-jdbc isn't difficult, but the rest of the setup is a bit more work. Here is the bean.
Code:
<bean id="dataSource" class="org.objectweb.cjdbc.driver.DataSource">
<property name="url"><value>jdbc:cjdbc://127.0.0.1:25322/vdb?user=vuser</value></property>
</bean>
I tried out both today with Hibernate with good results.
Cameron