Re: Reconnection problem

"Don Smith" <[email protected]> Sun, 21 Dec 2008 09:14:29 -0700
Newsgroups gmane.comp.db.mysql.java
Message-ID <[email protected]>
If you're using a connection pool, you need to add a valid connection checker. In JBoss, the mysql-ds.xml file would have these elements: 

<!-- Valid connection checker class --> 
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class- 

Regards, 
Don

>>> "Pierre Gilquin" <[email protected]> 12/21/2008 7:26 AM >>>
Hi all,


I have a Java Web application accessing MySql 5.0.50.

It seems that after a long idle time, I cannot reconnect again.

I use the following parameters  autoReconnect=true and maxReconnects=3 for the JDBC Driver.

I find a similar bug #4443 on  http://bugs.mysql.com/bug.php?id=4443 but I didnot find any workaround.

Thank in advance for any help.

Pierre



The trace :


[2008-12-18 10:04:04 MET] <WorkerThread8> com.webobjects.jdbcadaptor.JDBCAdaptor
Exception: EvaluateExpression failed: <com.webobjects.jdbcadaptor.MySQLPlugIn$My
SQLExpression: "SELECT PK FROM EO_PK_TABLE WHERE NAME = 'cas' FOR UPDATE">:
    Next exception:SQL State:08S01 -- error code: 0 -- msg: Communications link
failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Connection reset

STACKTRACE:

java.net.SocketException: Connection reset

        at java.net.SocketInputStream.read(SocketInputStream.java:113)
        at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.ja
va:75)
        at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNe
cessary(ReadAheadInputStream.java:94)
        at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.ja
va:122)
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1842)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2292)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534)