2.0.11,执行sql时提示 execute sql error: Communications link failure The last packet successfully received from the server was 3,600,017 milliseconds ago

Viewed 82

已知该sql关联的表数据量很大,
sql语句: insert into a select ... from b left jon c ... left join d ...

1.设置了 {"useSSL":"false","socketTimeout":"5600034"}。
2.SET query_timeout = 5000;
报错提示:

execute sql error: Communications link failure
引用
The last packet successfully received from the server was 3,600,017 milliseconds ago

疑问点:既然提示3,600,017ms,那么应该是某个参数超时造成的,需要调整哪个或者哪些参数避免执行异常呢?

1 Answers

JDBC连接异常处理流程参考:

  1. jdbc的url中加autoReconnect=true参数,并且wait_timeout设置24小时后观察
  2. 如果是使用catalog时出现的,可以看看mysql信息是否填写错误或者mysql驱动版本的原因
  3. testOnBorrow打开,可查阅:https://github.com/alibaba/druid/issues/5262