commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Westbom <swest...@yahoo.com>
Subject RE: [DBCP] Connections Die
Date Fri, 07 Mar 2003 17:51:40 GMT
I think that DBCP needs to be aware of the type of JDBC implementation classes
it is dealing with and pick the correct implementation wrappers for each JDBC
implementation.  Only use the generic wrappers for oddball drivers.

It is more development work for DBCP but would allow for proper encapsulation. 
The commercial products generally do this.

I don't think it is necessarily a good idea to catch it on checkout with a
validation query and return a new connection seamlessly.  I think that is
really right on the line for application versus framework code.

Thanks
Stephen

--- "McKinstry, Pete (HQP)" <Pete.McKinstry@rhi.com> wrote:
> 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.
> 
> -pgm
> 
> -----Original Message-----
> From: Stephen Westbom [mailto:swestbom@yahoo.com]
> 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
> validation
> query) when it gets a fatal connection error.  It should then throw an error
> to
> the application.
> 
> 
> --- "McKinstry, Pete (HQP)" <Pete.McKinstry@rhi.com> wrote:
> > Evelynn-
> > 
> > Have you tried specifying a validation query in your DBCP config? I
> believe
> > 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: http://jakarta.apache.org/commons/dbcp/apidocs/index.html
> > BasicDataSource
> > 	- validationQuery
> > 	- testOnReturn
> > 	- testWhileIdle
> > 	- testOnBorrow
> > 
> > fyi- I haven't used DBCP from w/in Tomcat, so i'm not sure how to
> configure
> > there, but it should be do-able...
> > 
> > -pgm
> > 
> > -----Original Message-----
> > From: Evelynn [mailto:evelynnuser1@earthlink.net]
> > Sent: Thursday, March 06, 2003 5:31 PM
> > To: commons-user@jakarta.apache.org
> > 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
> do
> > not like about this solution is that the java code in my app now includes
> a
> > 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: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

Mime
View raw message