We recently migrated to using the apache tomcat jdbc connection pooling.
We are using v220.127.116.11 of the connection pooling mechanism with tomcat 6.0.33 on Oracle 10g
Our connection pools are configured as follows:
<Resource name="jdbc/testPool" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" url="jdbc:oracle:thin:@192.168.1.11:1521:TESTDB" username="user" password="xxx" initialSize="2" maxActive="5" minIdle="1" maxIdle="2" maxWait="1" removeAbandoned="true" removeAbandonedTimeout="15" logAbandoned="true" abandonWhenPercentageFull="100" jdbcInterceptors="ResetAbandonedTimer"/>
The application works fine in normal situations but we noticed the following problems:-
a) When the ResetAbandonedTimer kicks in the connection itself does not get discarded and the app when it requests a new connection gets handed the connection that was already killed by the ResetAbandonedTimer mechanism .
b) We were also able to easily reproduce the above issue by running the application and then killing the idle connection from the oracle end. I would expect that if a connection gets killed from the oracle end the connection pool should detect it and log and discard the connection. However the apache-tomcat-jdbc pooling mechanism as configured in my setup does not seem to detect this condition at all. It waits silently till the app requests another connection and returns the dead connection to the app which of course fails as soon as the app tries to use the connection.
testOnBorrow="true" validationQuery="select 1 from dual"
in order to validate your connections