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 ** STACKTRACE: at com.mysql.jdbc.MysqlIO.readFully( at com.mysql.jdbc.MysqlIO.reuseAndReadPacket( at com.mysql.jdbc.MysqlIO.checkErrorPacket( at com.mysql.jdbc.MysqlIO.sendCommand( at com.mysql.jdbc.MysqlIO.sqlQueryDirect( at com.mysql.jdbc.Connection.execSQL( at com.mysql.jdbc.PreparedStatement.executeInternal( at com.mysql.jdbc.PreparedStatement.executeQuery( at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery( 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