Mysql默认状态下 空闲8小时就会自动断开,这是我第一次去链接数据库就会出现这样的错误The last packet successfully received from the server was 57,350,142 milliseconds ago. The last packet sent successfully to the server was 57,350,142 milliseconds ago. 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.请教解决方案。顺便附上我的环境
tomcat5.5
Mysql5.1.50
Connector/J: mysql-connector-java-5.1.8
tomcat5.5
Mysql5.1.50
Connector/J: mysql-connector-java-5.1.8
set wait_timeout= 57,350,142;永久性则需要在你的INI文件中修改。
另外就是什么语句需要执行这么长时候? 是数据量大?还是什么其它原因,毕竟一个语句需要 57,350,142这么长时间 15个小时也的确是有些长了。