产生的原因:应用方的数据库连接有效期时间,大于数据库自己设置的有效期。

解决方案:

一、修改druid配置(如果使用druid的话)

spring.datasource.druid.validationQuery=select 1
spring.datasource.druid.testWhileIdle=true
spring.datasource.druid.testOnBorrow=true
spring.datasource.druid.testOnReturn=true

PS.此方案对性能会有一定影响

二、修改数据库连接配置

在数据库连接上,加“&autoReconnect=true&failOverReadOnly=false”配置

三、修改数据库连接有效时间

在数据库配置上设置,把数据库连接有效时间设置长一点,比如设置12小时或者24小时

四、还可以参考这篇文章的其它方法:https://www.cnblogs.com/jpfss/p/7206912.html

数据库连接超时:“The last packet successfully received from the server was xxx milliseconds ago”的更多相关文章

  1. Mysql 的异常:The last packet successfully received from the server was 90 milliseconds ago. The last packet sent successfully to the server was 43,603,303 milliseconds ago. is longer than the server con

    调试一个程序, 调试到一半, 下班回家, 程序卡在了某一行, 第二天早上回来一看, 发现了异常: Wed Sep :: GMT+: WARN: Establishing SSL connection ...

  2. The last packet successfully received from the server was 20,519 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

    本地升级了下MySQL的版本,从5.6升为5.7,数据文件直接拷贝的,项目查询数据库报错: Could not retrieve transation read-only status server ...

  3. The last packet successfully received from the server was 1,480 milliseconds ago.

    场景:一个上传接口,需要上传几十M的文件,文件中包含10几W的数据,然后对10+W的数据进行同步批量插入,每次批量插入1W.最后返回结果. 项目上线一段时间后,上传接口出现问题,数据库用的MySQL5 ...

  4. The last packet successfully received from the server was 2,926,157 milliseconds ago. The last packet sent successfully to the server was 2,926,158 milliseconds ago. is longer than the server configured value of 'wait_timeout'. 解决办法

    Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully rec ...

  5. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 78,050,512 milliseconds ago.

    今天访问已经架上服务器的网站,报错: Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet s ...

  6. Communications link failure,The last packet successfully received from the server was *** millisecon

    使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...

  7. 【异常】ser class threw exception: java.sql.SQLException: The last packet successfully received from the server was 39,444 milliseconds ago. The last

    1 详细异常 ser class threw exception: java.sql.SQLException: The last packet successfully received from ...

  8. The last packet successfully received from the server was 39,900 milliseconds ago问题解决

    1,之前用Mysql或者mycat的时候都没有这个问题.后来改为haproxy+keepalived+mycat后出现这个问题 2,网上查了很多说法,我按照网上说的改了 datasource: url ...

  9. The last packet successfully received from the server was 49,061,696 millise

    解决连接:https://blog.csdn.net/pandajava/article/details/41946251

随机推荐

  1. 代码块: 以冒号作为开始,用缩进来划分作用域,这个整体叫做代码块,python的代码块可以提升整体的整齐度,提高开发效率

    # ### 代码块: 以冒号作为开始,用缩进来划分作用域,这个整体叫做代码块 if 5 == 5: print(1) print(2) if True: print(3) print(4) if Fa ...

  2. git reset与git revert的区别

    http://alpha-blog.wanglianghome.org/2010/07/30/git-partial-rollback/ reset(版本撤回) 格式 git reset [-q] [ ...

  3. Servlet服务器、客户端跳转

    服务期跳转.服务器端转发.服务器端重定向是一个意思使用“req.getRequestDispatcher(“跳转路径”).forward(req,resp)”实现服务器端转发 客户端发送请求后数据传输 ...

  4. 利用data属性来存json、和取数据还原json

    data属性用JSON.stringify转化为字符串存进去,,,取出来自动会变成json数组的

  5. Ribbon标题语句

    感谢每一次成长的喜悦和感动,谢谢一路有你!我会比从前更爱你,希望     你能陪我走过这一生!网址:http://www.uc123.com/

  6. md5加密utils

    package cn.itcast.bos.utils;   import java.math.BigInteger; import java.security.MessageDigest; impo ...

  7. python爬虫中scrapy框架是否安装成功及简单创建

    判断框架是否安装成功,在新建的爬虫文件夹下打开盘符中框输入cmd,在命令中输入scrapy,若显示如下图所示,则说明成功安装爬虫框架: 查看当前版本:在刚刚打开的命令框内输入scrapy versio ...

  8. Respone弹窗

    Response.Write("<script>window.open('default.aspx?iID=" + GridView1.DataKeys[GridVie ...

  9. 安装jar包到本地仓库和远程仓库

    转载: https://blog.csdn.net/zengdongwen/article/details/81241198 如何部署到maven中央仓库呢? https://blog.csdn.ne ...

  10. 使用vscode调试小段的typescript代码

    最近在学习typescript.学习 嘛,当然免不了各种练习,试错.那么使用vscode就可以很方便的做到. 首先是安装node.js.我们知道,node.js提供了js脱离浏览器的执行平台.node ...