autoReconnect=true设置无效 待解决

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 145,178,488 milliseconds ago. The last packet sent successfully to the server was 145,178,488 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.

 

数据库:mysql 5.5.8

系统将read,write分两个DB

read,正常

但是在write的时候,报以上错误。而在数据库的配置中,已经有autoReconnect=true 看来不起作用。。。

临时解决方法,就是重启应用。

但是不是解决之道.

 

网上搜索,说是修改mysql数据库的wait_timeout 。但遭到了DBA的强烈抵制,会影响其他的mysql的性能。

 

记录一下问题,待解决。。。

 

备注:mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用

你可能感兴趣的:(Connection)