autoreconnect mysql true_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版本,起作用

分享到:

2011-08-04 17:57

浏览 23670

分类:数据库

评论

6 楼

pkkfcuso

2013-07-30

是因为mysql默认wait_timeout为8小时,超过后连接池会自动关闭

连接数据库时修改这三个参数就可以了· 每个小时自动连接一次·保持连接可用

5 楼

pkkfcuso

2013-07-30

http://www.cnblogs.com/Bruce-Goo/p/3224829.html

4 楼

kabuchino

2013-03-25

一直没有找出处理的办法

不过后来由于业务的需要,需要做一个每天都要启动的定时器。

自从定时器部署了之后,就再也没有出现这个问题了。

很无奈的解决之道

3 楼

lvye351

2013-02-06

连接池自己改,取链接前检查,如果无效,则重新获取连接。apache 的dbcp,c3p0连接池都支持此属性。dbcp 参数是TestOnBorrow

2 楼

lvye351

2013-02-05

楼主你最后怎么解决的?

1 楼

lvye351

2013-02-05

我也碰到此问题。mysql autoReconnect=true。连接里autoReconnect=true 看来不起作用。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值