Hi
 
We are facing connection leak problem with c3p0-0.9.1.2.jar. We are closing all DB connections , statements and result sets properly in all our methods with the following code :
 
finally {
    try{
            resultset.close();
            resultset = null;
        }catch(Exception e) {}
 try{
            statement.close();
            statement = null;
 }catch(Exception e) {}
 try{
            conneciton.close();
            connection = null;
 }catch(Exception e) {}
}
 
I have checked all our code and every where we are closing connection and other resources properly. But somehow connections are still getting leaked.Please find the 'ComboPooledDataSource' properties we are using below :
 
com.mchange.v2.c3p0.ComboPooledDataSource cpds = new com.mchange.v2.c3p0.ComboPooledDataSource();
cpds.setDriverClass(driver);
cpds.setJdbcUrl(url);
cpds.setMinPoolSize(5);
cpds.setAcquireIncrement(5);
cpds.setMaxPoolSize(300);
cpds.setMaxIdleTime(600);
cpds.setUnreturnedConnectionTimeout(600);
cpds.setDebugUnreturnedConnectionStackTraces(true);
cpds.setMaxStatements(0);

We are using the following string to print pool status in the log :

"connection pool, total: " + cpds.getNumConnectionsAllUsers() + ", busy: " + cpds.getNumBusyConnectionsAllUsers() + ", max: " + cpds.getMaxPoolSize() + ", unclosed: " + cpds.getNumUnclosedOrphanedConnectionsAllUsers();

After a day or so , the following message is seen in the log and after that no new connections can be obtained and all DB operations are failing :

connection pool, total: 300, busy: 300, max: 300, unclosed: 0

We open around 30 connections every 2 minutes and close them. After a day all DB operations are failing in the application since all connections in the pool are busy and max pool size is reached.Can anyone please help me to fix this problem ?

Thanks & Regards,

RamaKrishna.