commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "McKinstry, Pete (HQP)" <>
Subject RE: [DBCP] Connections Die
Date Fri, 07 Mar 2003 17:20:16 GMT
For validation queries, it quietly kills the connection & attempts to use a
different one from the pool (or re-create if necessary). Thereby getting the
desired behavior.

In the context of normal connection usage, how would it know what a fatal
error is? Each database is different, and SQLExceptions aren't necessarily
fatal. That's the trick.


-----Original Message-----
From: Stephen Westbom []
Sent: Friday, March 07, 2003 8:53 AM
To: Jakarta Commons Users List; 'Evelynn'
Subject: RE: [DBCP] Connections Die

The pool should really kill the connection itself (with or without a
query) when it gets a fatal connection error.  It should then throw an error
the application.

--- "McKinstry, Pete (HQP)" <> wrote:
> Evelynn-
> Have you tried specifying a validation query in your DBCP config? I
> it destroys connections in the pool where the validationQuery throws a
> SQLException. This may solve your problem w/o having to close & re-create
> the DataSource.
> See:
> BasicDataSource
> 	- validationQuery
> 	- testOnReturn
> 	- testWhileIdle
> 	- testOnBorrow
> fyi- I haven't used DBCP from w/in Tomcat, so i'm not sure how to
> there, but it should be do-able...
> -pgm
> -----Original Message-----
> From: Evelynn []
> Sent: Thursday, March 06, 2003 5:31 PM
> To:
> Subject: [DBCP] Connections Die
> Reference: Tomcat 4.1.18
> My dbcp goes dead at times.
> My application on Tomcat is on one box and my DB2 database is on another
> box.  If the network goes down for a brief period or the database is
> bounced, my dbcp no longer works and I receive an SQLException from my
> application running on Tomcat.
> So, here is my fix to refresh the connection pool.  When ever I receive an
> SQLException, I run the following once:
> import javax.sql.DataSource;
> import org.apache.commons.dbcp.BasicDataSource;
> .......
> BasicDataSource bds = (BasicDataSource)myDataSource;
> bds.close();
> I tested this and it seems to solve the problem.    The only thing that I
> not like about this solution is that the java code in my app now includes
> reference to the DBCP java class.  But that's OK.  I can live with that.
> My question is, is this solution OK or is there a better recommendation to
> refresh the dbcp?
> Thanks
> Eve
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more

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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message