You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ajay kumar <aj...@gmail.com> on 2005/06/14 07:49:27 UTC

Getting DBCP Exception

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

             I think it is the problem with the values which are
mentioned in the server.xml for DBCP.Here are the details of
server.xml

<parameter>
  <name>maxActive</name>
  <value>100</value>
</parameter>
<parameter>
  <name>maxIdle</name>
  <value>20</value>
</parameter>
<parameter>
 <name>maxWait</name>
 <value>10000</value>
</parameter>
<parameter>
  <name>removeAbandoned</name>
  <value>true</value>
</parameter>
<parameter>
  <name>removeAbandonedTimeout</name>
  <value>300</value>
</parameter>
<parameter>
   <name>logAbandoned</name>
   <value>true</value>
</parameter>

                If any body know the solution please mail me the
details.Thanks in advance...

-- Ajay


-- 
Ajay

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Getting DBCP Exception

Posted by Jon Wingfield <jo...@mkodo.com>.
Ajay,

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

<extract-from-doco>
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
</extract-from-doco>

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 
default).

The parameter you need to set is validationQuery as per:
http://jakarta.apache.org/commons/dbcp/configuration.html

HTH,

Jon

Anto Paul wrote:
> On 6/14/05, ajay kumar <aj...@gmail.com> 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
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Common%20Problems
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Getting DBCP Exception

Posted by Anto Paul <an...@gmail.com>.
On 6/14/05, ajay kumar <aj...@gmail.com> 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
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Common%20Problems

-- 
rgds
Anto Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org