tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Wingfield <>
Subject Re: Getting DBCP Exception
Date Tue, 14 Jun 2005 08:31:08 GMT

That's a mySQL error message.
In the jdbc url you can add parameters to automate reconnection:

autoReconnect   should the driver attempt to re-connect if the 
connection dies? (true/false) -> false

maxReconnects   if autoReconnect is enabled, how many times should the 
driver attemt to reconnect? -> 3

initialTimeout  if autoReconnect is enabled, the initial time to wait 
between re-connects (seconds) -> 2

If you've already have this set, do you see the Exceptions when/after 
you bounce the database? I think you can also see this error message if 
an admin kills a running database query from the processlist - the 
client thinks the database has gone away.

If the above aren't the problem then maybe the communication between the 
client and mysql server isn't "fast enough". You may have to tweak the 
client and server connection timeout parameters (in my.cnf in the server).

You can also configure DBCP to give a pooled connection a kick to stop 
it timing out (mysql times out idle connections after, IIRC, 8hrs by 

The parameter you need to set is validationQuery as per:



Anto Paul wrote:
> On 6/14/05, ajay kumar <> wrote:
>>Hi Everybody,
>>             This is Ajay Kumar.I implemented DBCP through tomcat
>>container.Some times when i run the webpages it is giving the
>>following Exception:
>>org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Server
>>connection failure during transaction. Attempted reconnect 3 times.
>>Giving up
> What database you are using ? Read this doc

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

View raw message