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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]