法律咨询 2012-2-14 8:56:00
经济案件 2012-2-14 8:56:00
山西路上交通事故的赔偿 2012-2-14 8:55:00
收送养孩子 2012-2-14 8:54:00
房产问题 2012-2-14 8:53:00
交通事故责赔偿标准 2012-2-14 8:53:00
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed by the driver.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1012)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
at com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1204)
at com.mysql.jdbc.ConnectionImpl.getMutex(ConnectionImpl.java:3165)
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4783)
at dao.MessageDaoImpl.insertAll(MessageDaoImpl.java:68)
at ReadFile.SaveIntoDataBase.saveAll(SaveIntoDataBase.java:13)
at ReadFile.ReadFile.main(ReadFile.java:144)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failureThe last packet successfully received from the server was 5,015 milliseconds ago.  The last packet sent successfully to the server was 5,015 milliseconds ago.
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3056)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2942)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3485)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2690)
at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1654)
at dao.MessageDaoImpl.insertAll(MessageDaoImpl.java:66)
... 2 more
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:2503)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2953)
... 9 more
上面的文字是我控制体打印出来的数据这个说明正确的插入到了数据库了。如果不出问题就该一直打印信息
可是为什么 运行着运行着就突然报了这个错误啊!
求高手指点 !!!!

解决方案 »

  1.   

    com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed by the driver.
    连接关闭后不允许进行操作
    你在数据库连接已经关闭后仍然在执行操作
      

  2.   

    Can not read response from server
      

  3.   

    很可能是你长时间没有操作数据库,然后连接被关闭了,你在去操作的时候就会报这个,mysql驱动好像是有这个问题的,默认时间应该是8小时吧
      

  4.   

    com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed by the driver.Connection 关闭啦 ,还有进行什么操作啊 ?
      

  5.   

    这个比较明显看看你的close方法写的有没有问题。