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

解决方案:

一、修改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. C++ cout格式化输出

    表1:C++ 流操纵算子 流操纵算子 作  用 *dec 以十进制形式输出整数 常用 hex 以十六进制形式输出整数 oct 以八进制形式输出整数 fixed 以普通小数形式输出浮点数 scienti ...

  2. C# 弹出确定、取消窗口

    if (MessageBox.Show("确定要退出吗?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Qu ...

  3. phpStudy环境安装SSL证书教程

    第一步:修改apache目录下的httpd.conf配置文件(D:\phpStudy\PHPTutorial\Apache\conf\ ) #LoadModule ssl_module modules ...

  4. Linux Maven安装

    Maven 官网,下载maven 包 http://maven.apache.org/download.cgi 下载完成:apache-maven-3.6.1-bin.tar.gz 解压到自定义目录: ...

  5. Vim搜索、取消高亮、显示行数、取消行数

    1.显示行数 :set nu 2.取消行号 :set nu! 3.高亮搜索 /target 4.取消高亮 :noh

  6. sys模块

    #python run_case.py #在terminal中执行.py文件 在terminal中执行.py文件: 注: 无法使用terminal来打开那个文件 会显示如下:python: can't ...

  7. Python hasattr() 函数

    hasattr() 函数用于判断对象是否包含对应的属性.(has attribute) hasattr(object, name) 参数 object -- 对象. name -- 字符串,属性名. ...

  8. oracle 对表的操作

    对日期数据的插入 insert into tabname(datecol) value(sysdate) ;  -- 用date值 insert into tabname(datecol) value ...

  9. Leetcode 存在重复元素 (219,220)

    219. 存在重复元素 II 给定一个整数数组和一个整数 k,判断数组中是否存在两个不同的索引 i 和 j,使得 nums [i] = nums [j],并且 i 和 j 的差的绝对值最大为 k. / ...

  10. 20190317 A

    今天是学长wsy的题,我理论会100+50+30=180,实际100+20+10=130,充分体现我的菜 最近日常模拟赛挂分50到60,很危险,这2天一定要调整好... Upd:T2我认为50的划分数 ...