RSS RSS feed | Atom Atom feed | |

MySQL problem with Apache connection pools

The latest isn't the greatest

The Apache commons-dbcp-1.2.2.jar doesn't work and play well with MySQL. The symptom is an error when a call is made to MySQL after the connection has timed out. This happens with Spring SQL template as well as many ORM tools such as Hibernate.

I discovered it when converting an application from Struts 1 to Struts 2 and updated the commons jars. Here is what the stack trace looks like.

Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1963) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2375) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2874) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715) at com.mysql.jdbc.Connection.execSQL(Connection.java:3249) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1403) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93) at 

The solution is to back off commons-dbcp to version commons-dbcp-1.2.1.jar. See this bug report for more information.




Add a comment Send a TrackBack