Ok, I'm getting some strange behaviour with dbcp as detailed below:
Here is the config for it:
connectionPool = new GenericObjectPool(null); connectionPool.setMaxActive(50); connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW); connectionPool.setMaxIdle(50); connectionPool.setNumTestsPerEvictionRun(5); connectionPool.setTestWhileIdle(true); connectionPool.setTimeBetweenEvictionRunsMillis(20000); connectionPool.setTestOnBorrow(true); connectionPool.setTestOnReturn(false); connectionPool.setMinEvictableIdleTimeMillis(-1);
DriverManagerConnectionFactory connectionFactory = new DriverManagerConnectionFactory(dbUrl, props); PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true); pool = new PoolingDataSource(connectionPool);
Not sure if this will fix the problem but I noticed you are not supplying a validationQuery when you create the PoolableConnectionFactory. As you are testing the connection while idle and testOnBorrow is also true, the pool should be running a test eg
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,"SELECT test FROM testtable",false,true);
-- Jason Lea Email: [EMAIL PROTECTED] Phone/Fax: +64 3 381 2907 Mobile: +64 21 040 2708 Address: 9a Tabart Street, Christchurch, New Zealand
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
