> -----Original Message-----
> From: Jacob Rhoden [mailto:[EMAIL PROTECTED]
> 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).

Tim



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to