commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <>
Subject Re: DBCP - behavior of dbcp when db is restarted
Date Thu, 06 Sep 2007 20:13:15 GMT
On 9/5/07, Wm.A.Stafford <> wrote:
> We are using DBCP in a refactored web application that, in the past,
> used a locally written connection pool.  This original pool always
> checked a connection object to see if it was NULL before handing it
> out.  I was told that this was because the  DB was unstable at one point
> and the pool was handing out connections that were null after a db restart.
> I would like to know if this is an issue with DBCP.  I can't image that
> it would be, this seems like a common enough situation.  However, the
> higher ups are concerned that we have subtracted functionality by using

DBCP can be configured to validate connections before lending them
them to clients. Its method of doing so is to execute a "validation
query" that must return at least one row to succeed.  There is
currently no built-in facility for testing for null or bad connections
other than this.  Assuming you are using BasicDataSource, the relevant
configuration parameters to ensure connections are tested before being
returned to clients are testOnBorrow and validationQuery (see  You can also
force connections to be tested when they are returned to the pool by
setting testOnReturn to true.

DBCP's abilities to handle network and database failure / recovery
scenarios are primitive - validation as above is pretty much all that
exists and validation queries can hang in the event of a network
failure (see  Patches,
suggestions for improvement are welcome.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message