MySQL服务器连接超时
MySQL服务器连接等待超时为28800秒,我的hibernate应用程序一直超时(整个应用程序生命周期约为1小时) 从服务器成功接收的最后一个数据包是4396266毫秒前。最后一个成功发送到服务器的数据包是4405476毫秒前的数据包。 hibernate使用以下c3p0属性,我不明白为什么它会超时,即使整个应用程序运行了大约1个小时,并且空闲时间应该比这少得多。既然hibernate的连接有5000秒的超时值,加上它每300秒检查一次空闲,为什么会发生这种情况MySQL服务器连接超时,mysql,hibernate,timeout,Mysql,Hibernate,Timeout,MySQL服务器连接等待超时为28800秒,我的hibernate应用程序一直超时(整个应用程序生命周期约为1小时) 从服务器成功接收的最后一个数据包是4396266毫秒前。最后一个成功发送到服务器的数据包是4405476毫秒前的数据包。 hibernate使用以下c3p0属性,我不明白为什么它会超时,即使整个应用程序运行了大约1个小时,并且空闲时间应该比这少得多。既然hibernate的连接有5000秒的超时值,加上它每300秒检查一次空闲,为什么会发生这种情况 <property na
<property name="hibernate.c3p0.min_size">0</property>
<property name="hibernate.c3p0.max_size">200</property>
<property name="hibernate.c3p0.idle_test_period">300</property>
<property name="hibernate.c3p0.timeout">5000</property>
0
200
300
5000
更新:详细错误消息:
Caused by: java.sql.BatchUpdateException: Communications link failure
The last packet successfully received from the server was 5,980,742 milliseconds ago. The last packet sent successfully to the server was 5,9\
87,659 milliseconds ago.
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2024)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:56)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2421)
... 15 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 5,980,742 milliseconds ago. The last packet sent successfully to the server was 5,9\
87,659 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:407)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3358)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1970)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1976)
... 20 more
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3339)
原因:java.sql.BatchUpdateException:通信链路故障
从服务器成功接收的最后一个数据包是5980742毫秒前的数据包。成功发送到服务器的最后一个数据包是5,9\
87659毫秒前。
位于com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2024)
位于com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
在com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
位于org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
位于org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:56)
位于org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2421)
... 还有15个
原因:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链路故障
从服务器成功接收的最后一个数据包是5980742毫秒前的数据包。成功发送到服务器的最后一个数据包是5,9\
87659毫秒前。
位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
位于java.lang.reflect.Constructor.newInstance(Constructor.java:513)
位于com.mysql.jdbc.Util.HandleneInstance(Util.java:407)
位于com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
在com.mysql.jdbc.MysqlIO.send上(MysqlIO.java:3358)
位于com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1970)
位于com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)
位于com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
位于com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
位于com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
位于com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1976)
... 20多
原因:java.net.SocketException:管道断裂
位于java.net.SocketOutputStream.socketWrite0(本机方法)
位于java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
位于java.net.SocketOutputStream.write(SocketOutputStream.java:136)
位于java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
位于java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
在com.mysql.jdbc.MysqlIO.send上(MysqlIO.java:3339)
您如何知道是SQLServer连接超时?您尚未发布错误消息。@Jim,上面更新了错误消息。您如何知道是SQLServer连接超时?您尚未发布错误消息。@Jim,上面更新了错误消息。 Caused by: java.sql.BatchUpdateException: Communications link failure The last packet successfully received from the server was 5,980,742 milliseconds ago. The last packet sent successfully to the server was 5,9\ 87,659 milliseconds ago. at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2024) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:56) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2421) ... 15 more Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 5,980,742 milliseconds ago. The last packet sent successfully to the server was 5,9\ 87,659 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:407) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3358) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1970) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415) at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1976) ... 20 more Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3339)