mysql连接等待超时引发的异常
2018-01-29 11:31
316 查看
当mysql链接空闲超过默认时长(没做配置的话),链接会自动断开,这时再去访问会发生如下异常:
为了避免此问题可以给mysql加一个配置:
idleConnectionTestPeriod: 3600
mysql会每隔3600自动去发起一条sql以保持数据库链接,另外这个时间一定要小于数据库链接的等待超时时间才行。
### Error querying database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 216,960,986 milliseconds ago. The last packet sent successfully to the server was 216,960,987 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. ### The error may exist in URL [jar:file:****] ### The error may involve ****-Inline ### The error occurred while setting parameters ### SQL: ****
为了避免此问题可以给mysql加一个配置:
idleConnectionTestPeriod: 3600
mysql会每隔3600自动去发起一条sql以保持数据库链接,另外这个时间一定要小于数据库链接的等待超时时间才行。
相关文章推荐
- Nhibernate中的连接超时时事务回滚引发异常的处理方法
- Tomcat+MySQL应用中连接超时造成各种异常情况的处理
- Flash Builder 4 无法调试,正在等待 adobe flash player 连接调试器,连接失败;会话已超时
- 如何设置mysql 数据库连接超时
- MySQL连接超时
- ADO.NET实体框架连接串引发的异常:Unable to load the specified metadata resource
- Linux下mysql修改连接超时(windows下也适用)
- 解决MySQL 5数据库连接超时问题
- mysql事物锁等待超时,报错 Lock wait timeout exceeded; try restarting transaction
- MySQL连接问题【如何解决MySQL连接超时关闭】
- MySql 长时间读数据发生超时的异常 Mysql Reader Exception TimeOut expired
- mysql 连接池连接超时的问题
- MYSQL 连接超时问题
- MySQL连接超时自动断开连接问题
- 阿里云服务器3306端口MySQL连接异常
- HTTP网络连接相关知识整理(四):超时异常
- Navicat连接mysql出现2003——can't connect to mysql server on localhost(10061)引发的思考)
- myBatis连接MySQL报异常:No operations allowed after connection closed.Connection was implicitly closed
- mysql连接超时timeout问题
- MySQL从库选项log-slave-updates未启用引发的异常