数据库连接超时:“The last packet successfully received from the server was xxx milliseconds ago”
产生的原因:应用方的数据库连接有效期时间,大于数据库自己设置的有效期。
解决方案:
一、修改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”的更多相关文章
- 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 ...
- 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 ...
- The last packet successfully received from the server was 1,480 milliseconds ago.
场景:一个上传接口,需要上传几十M的文件,文件中包含10几W的数据,然后对10+W的数据进行同步批量插入,每次批量插入1W.最后返回结果. 项目上线一段时间后,上传接口出现问题,数据库用的MySQL5 ...
- 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 ...
- 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 ...
- Communications link failure,The last packet successfully received from the server was *** millisecon
使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...
- 【异常】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 ...
- The last packet successfully received from the server was 39,900 milliseconds ago问题解决
1,之前用Mysql或者mycat的时候都没有这个问题.后来改为haproxy+keepalived+mycat后出现这个问题 2,网上查了很多说法,我按照网上说的改了 datasource: url ...
- The last packet successfully received from the server was 49,061,696 millise
解决连接:https://blog.csdn.net/pandajava/article/details/41946251
随机推荐
- python-迭代器与可迭代对象
迭代器与可迭代对象 简述 迭代是数据处理的基石.扫描内存中放不下的数据集时,我们要找到一种惰性获取数据项的方式,即按需一次获取一个数据项.这就是迭代器模式 迭代器 迭代器是这样一个对象,实现了无参数_ ...
- 训练集(train set),验证集(validation set)和测试集(test set)
把数据集分为三部分,分别为:训练集(train set),验证集(validation set)和测试集(test set). 具体比例有各种说法.待补充 测试集是为了测模型泛化能力,不能在训练的时候 ...
- java 写一个JSON解析的工具类
上面是一个标准的json的响应内容截图,第一个红圈”per_page”是一个json对象,我们可以根据”per_page”来找到对应值是3,而第二个红圈“data”是一个JSON数组,而不是对象,不能 ...
- matlab——之class类(详细总结)
https://blog.csdn.net/qinze5857/article/details/80545885 开篇:搜了一下网上介绍matlab的class类,信息不全,且总结不全面,于是单独he ...
- 打开eclipse "Initializing Java Tooling"错误
问题:打开eclipse初始化界面过程中弹出An internal error occurred during: "Initializing Java Tooling". java ...
- 铁大Facebook隐私保护NABCD
隐私保护功能: N:满足了用户保护自己隐私信息的需求 A:对每一项用户可能需要保护的信息,我们都会添加仅自己可见.指定人可见.部分人可见或所有人可见设置 B:让用户的信息受到更全面的保护,而不仅仅是对 ...
- 在vue中使用echarts图表
在vue中使用echarts图表 转载请注明出处:https://www.cnblogs.com/wenjunwei/p/9815290.html 安装vue依赖 使用npm npm instal ...
- webdriver.chrome()禁止加载图片
from selenium import webdriver chrome_options = webdriver.ChromeOptions() prefs = {"profile.man ...
- Mysql 导入CSV文件,中文内容乱码问题
项目中用到含有中文字段的数据CSV文件,导入Mysql数据中发现中文内容乱码. 分析原因:因为数据库字符编码问题引起. [1]创建utf-8字符集数据库 CREATE DATABASE db_name ...
- Typescript 和 Javascript之间的区别
TypeScript 和 JavaScript 是目前项目开发中较为流行的两种脚本语言,我们已经熟知 TypeScript 是 JavaScript 的一个超集,但是 TypeScript 与 Jav ...