Reputation: 19270
In our project we are maintaining our own DB connection pool.
For resolving the issue 'java.sql.SQLRecoverableException: Io exception
most of people has suggested to use standard connection pool like apache dbcp.
Kindly answer all my questions.
Upvotes: 1
Views: 1454
Reputation: 21903
I am answering this question assuming that you made use of Apache DBCP for connection pooling by using org.apache.commons.pool.impl.GenericObjectPool
, org.apache.commons.dbcp.DataSourceConnectionFactory
, org.apache.commons.dbcp.PoolableConnectionFactory
and org.apache.commons.dbcp.PoolingDataSource
classes.
GenericObjectPool.testOnBorrow
and GenericObjectPool.testOnReturn
are set true to The Connection will be validated whether it is active or not using a validationQuery
set in PoolableConnectionFactory
. If the validation is failed the Connection object is dropped and new one is created and added to the pool minEvictableIdleTimeMillis
in GenericObjectPool
along with timeBetweenEvictionRunsMillis
if you want to remove based on idle timeUpvotes: 2