tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Lucia" <>
Subject RE: Mysql timouts...
Date Thu, 22 Feb 2007 15:41:03 GMT

> -----Original Message-----
> From: Jacob Rhoden []
> Sent: Thursday, February 22, 2007 8:44 AM
> To: Tomcat Users List
> Subject: Re: Mysql timouts...
> I will have to read the documents to find out why having the connection
> automatically reconnected if there was a problem is bad thing, it is not
> clear from first reading.

It's not a bad thing, it's misunderstood.  Auto reconnect says that if I get
an exception because the connection is no longer valid, the NEXT time I get
a connection, automatically reconnect.  Your code needs to handle the retry,
in order to benefit from auto reconnect.

Instead, you should have a validation query and set testOnBorrow=true (the
default value).  That way, Tomcat (DBCP) guarantees the connection is good
before it hands it off to you, and you do not need to have the retry logic
in your application.  The simplest validation query is SELECT 1 (SELECT 1
FROM DUAL - for Oracle).


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message