commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: about connection
Date Thu, 02 Dec 2004 20:26:12 GMT
One simple approach is to set the "validationQuery" property to an SQL
statement that does a simple select or something.  If this is set,
DBCP will ensure that this query works successfully before handing you
back the connection.  If the database has timed out the connection
while it was sitting in the pool, the query will fail, and DBCP will
close this connection and go grab another one (creating a new one if
needed).

Craig



On Thu, 2 Dec 2004 13:17:13 -0700, haipeng du <haipengdu@gmail.com> wrote:
> I use BasicDataSource as my datasource. A connection is created when I
> connected to database. Then connection was returned back to connection
> pool. But after long time (such as one ten hours), the connection can
> be used to connected to database. How could I set some timeout
> parameters so that I can check if that connection can not be used , I
> just make it to null and create a new connection? Do we have other
> ways to solve this problem?
> Thanks a lot.
> 
> --
> Haipeng Du
> Software Engineer
> Comphealth,
> Salt Lake City
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

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


Mime
View raw message