commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: [DBCP] re-establish severed connections
Date Mon, 23 Feb 2009 23:37:51 GMT
John Cartwright wrote:
> 
> 
> Mark Thomas wrote:
>> The validation query on its own does nothing. Have you tried setting
>> testOnBorrow="true" ? That may be sufficient if you can live with a
>> slight delay
>> if a broken connection needs to be refreshed.
>>
>> Mark
>>   
> Thanks Mark, I have the "testWhileIdle=true" which I understood would
> run the validationQuery when the evictor thread fires up - is that
> correct?
Correct.

>  In limited testing, DBCP in this configuration seems to even
> re-establish connections after a database restart.  Any further advice
> that you can offer in dealing w/ that situation?

I'd use both. The evictor thread might not catch all the broken connections in
the pool before you try and borrow one. testOnBorrow will ensure you don't give
you app a broken connection while testOnIdle will ensure that you rarely get a
delay on borrow due to having to fix a broken connection.

Mark

> 
> Listed below is my current configuration which seems to be working. 
> Many thanks for your help!
> 
> --john
> 
> <Resource name="jdbc/CHEETAH"
>          type="javax.sql.DataSource"
>          auth="Container"
>          username="user"
>          password="passwd"
>          driverClassName="oracle.jdbc.OracleDriver"
>          url="jdbc:oracle:thin:@hostname:1521:CHEETAH"
>          maxActive="8"
>          maxIdle="4"
>          validationQuery="select 1 from dual"
>          testWhileIdle="true"
>          timeBetweenEvictionRunsMillis="300000"
>          minEvictableIdleTimeMillis="600000"/>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message