开发者社区> 问答> 正文

使用druid连接池 出现 The last packet successfully receive

使用druid连接池 出现 Caused by: com.mysql.cj.exceptions.CJCommunicationsException: The last packet successfully received from the server was 40,613,430 milliseconds ago,
我已经设置testOnBorrow为true

private String validationQuery = "select 1";
private int validationQueryTimeout = -1;
private boolean testOnBorrow = true;
private boolean testOnReturn = false;
private boolean testWhileIdle = true;
任然出现这样的问题,而且mysql数据库的wait_timeout也是默认的8小时

展开
收起
1122743730556131 2024-07-01 09:26:43 27 1
1 条回答
写回答
取消 提交回答
  • 在链接字符串上加上failOverReadOnly=false试试
    jdbc:mysql://hostname:port/database?failOverReadOnly=false&useSSL=false就是这样,回答不易请采纳

    2024-07-01 09:58:44
    赞同 2 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载