我是靠谱客的博主 虚拟镜子,最近开发中收集的这篇文章主要介绍You should consider either expiring and/or testing connection validity before use in your applicat,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

服务器数据库间断性的会出现数据库连接异常的报错,报错异常为

### Error querying database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 34,101 milliseconds ago. The last packet sent s

uccessfully to the server was 34,103 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before us

e in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

my.ini

--增加如下配置

wait_timeout=144000

interactive_timeout=144000

-- 保存后重启mysql服务


 

最后

以上就是虚拟镜子为你收集整理的You should consider either expiring and/or testing connection validity before use in your applicat的全部内容,希望文章能够帮你解决You should consider either expiring and/or testing connection validity before use in your applicat所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(51)

评论列表共有 0 条评论

立即
投稿
返回
顶部