Is it supposedly possible for java.sql.Statement.execute to throw java.io.EOFException?
In http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#execute%28java.lang.String,%20int%29 it is said that it may throw only java.sql.SQLException. However, I got this exception message logged:
** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1394) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1538) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1929) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278) at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1224) at com.mysql.jdbc.Connection.execSQL(Connection.java:2244) at com.mysql.jdbc.Connection.execSQL(Connection.java:2192) at com.mysql.jdbc.Statement.execute(Statement.java:906) at com.mysql.jdbc.Statement.execute(Statement.java:947) at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100) at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57) at $java.sql.Statement$$EnhancerByCGLIB$$4e952ca0.execute() at handler.do_insert(handler.java:734)
On line 733 of "handler.java" there is the "execute" call, and on 734 there is a call to getGeneratedKeys (which also may throw only SQLException).
Look for the words ** BEGIN NESTED EXCEPTION **
. This exception is not thrown by execute()
, it's a nested exception. That means that is was passed as the cause when creating the SQLException
. Something like this:
try {
...
} catch (EOFException e) {
throw new SQLException(e);
}