commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: DBCP Configuration Question
Date Fri, 19 Aug 2011 20:48:39 GMT
On 8/19/11 1:06 PM, Jeff_Blumenthal@Dell.com wrote:
> Hi Everyone,
>
> What is the best way to config the commons DB connection pools to ensure there are not
any stale/bad connections?
These comments refer to 1.x versions of DBCP.

The simplest way is to set testOnBorrow to true and set up a
validation query.  If your app holds connections long enough for
them to go bad before they get returned (generally a bad idea) you
can also set testOnReturn to true.  These settings, with a
validation query, cause the pool to test the connections on the way
out / in to the idle instance pool.   You can also use the pool
maintenance thread to "evict" connections that have been idle in the
pool too long or to test them periodically; but the first option
(testOnBorrow) is usually sufficient.
>
> Also, is there any relation between these 2 groups of parameters?
>
> timeBetweenEvictionRunsMillis
> minEvictableIdleTimeMillis
>
> removeAbandoned
> removeAbandonedTimeout

Not really.  The first set of parameters control the behavior of the
pool's maintenance thread.  The second control  "abandoned"
connection tracking and cleanup.  Abandoned connection cleanup is
triggered by connection requests and is not effected by the
maintenance thread settings.

Phil
>
> Thank you for your help,
> Jeff
>
>
>


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


Mime
View raw message