我分批读取数据,3个线程从同一个表中读取记录,每次读取20W条。数据表总共有200W条记录。
运行3-4分钟后就出现这个异常了,SQLException:Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException
MESSAGE: Can not read response from server. Expected to read 166 bytes, read 79 bytes before connection was unexpectedly lost.STACKTRACE:java.io.EOFException: Can not read response from server. Expected to read 166 bytes, read 79 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1997)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2464)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2916)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1360)
at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2369)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:451)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2076)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1451)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1787)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3206)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1232)
at com.tt.GoodsIndex.run(GoodsIndex.java:104)
** END NESTED EXCEPTION **Last packet sent to the server was 93984 ms ago.

解决方案 »

  1.   

    我也弄了一天了,都快到第二天了,,,,,,,,,,,,,,,,wuwuuw
      

  2.   

    我的不是WEB项目,MYSQL 5.067 +MYSQL JBDC CONNECT 5.08版,,
      

  3.   

    最后如何解决我也遇到了‘
    >      at java.lang.Thread.run(Thread.java:619)
    > Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 3 bytes before connection was unexpectedly lost.
    >         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2332)
    >         at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:1460)
    >         ... 17 more
    >
    >
    >