commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Lea <ja...@kumachan.net.nz>
Subject Re: [DBCP] Strange Problems and Errors
Date Tue, 01 Apr 2003 21:17:13 GMT
travis@spaceprogram.com wrote:
> 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:     jason@kumachan.net.nz
Phone/Fax: +64  3 381 2907
Mobile:    +64 21 040 2708
Address:   9a Tabart Street, Christchurch, New Zealand


Mime
View raw message