com.mysql.jdbc.CommunicationsException: Communications link failure. (no replies)

Submitted by programmer on Tue, 08/12/2008 - 11:02.

Hi All,

I am using mysql 5.0.8 connector and tomcat 6.0.10 DBCP.

My Application works well for few weeks, but after few weeks it get fail reporting the

error,

com.mysql.jdbc.CommunicationsException: Communications link failure

Last packet sent to the server was 1553186 ms ago.

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)

at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3246)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)

at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1383)

at

org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)

Caused by: java.net.SocketException: Connection reset

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:96)

at java.net.SocketOutputStream.write(SocketOutputStream.java:136)

at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)

at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)

at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3227)

It gets resolve after restarting the tomcat.

I am properly closing the connections but unable to understand the reason for this bug.

Here is the description of the configurations that I made in tomcat context file,

type="javax.sql.DataSource"

maxActive="100"

maxIdle="30"

maxWait="10000"

testOnBorrow="true"

testWhileIdle="true"

driverClassName="com.mysql.jdbc.Driver"

If anyone have some idea then plz tell me.