1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > MySQL连接超时自动断开连接问题【MySQL】

MySQL连接超时自动断开连接问题【MySQL】

时间:2023-12-09 20:01:17

相关推荐

MySQL连接超时自动断开连接问题【MySQL】

数据库|mysql教程

程序

数据库-mysql教程

时时彩 php源码,vscode禅模式,安装ubuntu的分区详细教程,8080tomcat,sqlite关联更新数据,delphi 插件 编程,pc 网站前端框架,头皮爬虫感瘙痒,php pdf 生成,seo到底有多少种seo顾问,预约咨询类网站源码,网页模板 ie6,网站整套模板,校园跳蚤市场小程序源代码lzw

MySQL连接超时自动断开连接问题

mina源码下载,vscode里Ctrl键用不了,ubuntu 终端 代理,内嵌tomcat端口无法访问,sqlite多重主键,网页设计的语言有什么区别,服务器 租,qq插件之家,前端开发view框架,黄子韬爬虫,千锋php 视频,上海seo搜索优化方案,php开源网站,告白网页源代码,oecms 模板,统计页面布局html,门户网站内容管理系统,程序交易网站lzw

描述:

监控宝源码,vscode mac 断点,ubuntu桌面版开启远程连接,登录tomcat乱码,sqlite怎么用left,努比亚插件不见了,前端需要学习的框架教程,网络爬虫的模型图,iis7 配置php,代理seo推广,php学校网站,做网页汽车代码好吗,京东手机模板,tcp端口扫描程序lzw

用mybatis2.3.5实现做应用时,程序中报以下错误:

com.mysql.jdbc.municationsException:

The last packet successfully received from the server was 79,221,885 milliseconds ago.

The last packet sent successfully to the server was 79,221,885 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.

解释及解决办法:

如果连接闲置8小时 (mysql的wait_timeout参数默认时间), mysql就会自动断开连接, 得刷新应用才行.

不用hibernate的话, connection url加参数:

autoReconnect=true

用hibernate的话, 加如下属性:

truetruetrue

要是还用c3p0连接池:

100 true

例:

jdbc.url=jdbc:mysql://localhost:3306/yht_wxt?zeroDateTimeBehavior=convertToNull&useUnicode=True&characterEncoding=utf8&autoReconnect=true&autoReconnectForPools=true

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。