We are trying to implement Oracle connection pooling with the help of Spring Framework. We are using DBCP connection pooling method. However the integration between DBCP and spring doesn't go down that well.
Problem that we face is that DBCP returns PoolableConnections Object while Oracle expects OracleConnection Objects. (Throws ClassCastException)
It seems that this problem has been handled in Oracle 11g. However I am curious as to how others have implemented Oracle connection pooling using spring framework for Oracle 10g (Using TOMCAT).
We use Ibatis as ORM framework.
I am sure there is a way. any help is appreciated.
I would use Oracles supplied solution, which in included in their ojdbc jars. The older way was with the class OracleConnectionPoolDataSource but now you can set a parameter on a regular OracleDataSource and get connection pooling.
Here is how to do it in Spring:
<bean id="datasource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
<property name="connectionCachingEnabled" value="true" />
<property name="URL" value="${jdbc.url}" />
...all your connection properties
<property name="connectionCacheProperties">
<props merge="default">
<prop key="MinLimit>3</prop>
<prop key="MaxLimit">20</prop>
</props>
</property>
</bean>