数据库连接超时的问题
来源:互联网 发布:易语言源码大全 编辑:程序博客网 时间:2024/05/17 06:36
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was43810 seconds ago.The last packet sent successfully to the server was 43810 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3246) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922) at com.mindpro.taxi.call.DBConnection.executeUpdate(DBConnection.java:64) at com.mindpro.taxi.call.PassengerService$UdpServiceThread.updatePassenger(PassengerService.java:259) at com.mindpro.taxi.call.PassengerService$UdpServiceThread.run(PassengerService.java:209)Caused by: java.net.SocketException: Software caused connection abort: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net.SocketOutputStream.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(Unknown Source) at java.io.BufferedOutputStream.flush(Unknown Source) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3227) ... 10 more
autoReconnect=true&failOverReadOnly=false 似乎不起作用
引用:http://blog.csdn.net/mqboss/article/details/6659001
1.按照错误的提示,可以在JDBC URL中使用autoReconnect属性,实际测试时使用了autoReconnect=true&failOverReadOnly=false,不过并未起作用,使用的是5.1版本,可能真像网上所说的只对4之前的版本有效。
2.没办法,只能修改MySQL的参数了,wait_timeout最大为31536000即1年,在my.cnf中加入:
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000
重启生效,需要同时修改这两个参数。
- 数据库连接超时的问题
- mysql5数据库连接超时问题的解决办法
- mysql5数据库连接超时问题的解决办法
- mysql5数据库连接超时问题的解决办法
- MySQL数据库连接超时(wait_timeout)问题的处理
- 关于activiti数据库连接超时的问题
- MySQL数据库连接超时(wait_timeout)问题的处理
- MySQL数据库连接超时(wait_timeout)问题的处理
- Mysql5数据库连接超时问题
- MySQL5数据库连接超时问题
- 解决MySQL5数据库连接超时问题
- 数据库连接超时问题(求解)
- 解决MySql数据库连接超时问题
- MySQL 5数据库连接超时问题
- 解决mysql数据库连接超时问题
- 关于tomcat启动超时 和mysql等数据库连接的问题
- 关于MySQL数据库连接超时问题的分析与解决
- 转载】MySQL数据库连接超时(wait_timeout)问题的处理
- 百度地图上的气泡
- Linux C 下的哈希表
- C函数注意点总结
- js多选框全选
- apache mod_cache
- 数据库连接超时的问题
- HDU 1712 ACboy needs your help(分组背包)
- 最大子矩阵问题
- c#委托事件
- linux gcc编译多个源文件的方法
- Win7平台VS2010安装Visual Assist X
- vc中调用TerminateThread终止线程所导致的死锁问题
- cocos2d-x笔记
- 不小心把终端的字弄的很小