title: ibatis + glassfish: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
body: <p>I keep getting the error randomly:</p>
  
  <p>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure</p>
  
  <p>Anyone got ideas?</p>
  
  <pre><code>ERROR: java.sql.Connection - Error calling Connection.setAutoCommit:
  com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  
  The last packet successfully received from the server was 129,064 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
      at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118)
      at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3055)
      at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2941)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489)
  
  Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
      at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2502)
      at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2952)
      ... 83 more
  </code></pre>