使用mysql jdbc连接tidb,有概率出现Communications link failure。同样代码连接mysql正常

【 TiDB 使用环境`】POC
【 TiDB 版本】v5.3.0
【遇到的问题】
使用mysql的jdbc连接提示异常
tidb nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

app.4163837c.js:1 Uncaught (in promise) Error:

Error querying database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet successfully received from the server was 8,990 milliseconds ago. The last packet sent successfully to the server was 8,996 milliseconds ago.

The error may exist in class path resource [mapper/system/SysDeptMapper.xml]

The error may involve com.ruoyi.system.mapper.SysDeptMapper.selectDeptList-Inline

The error occurred while setting parameters

SQL: select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time from sys_dept d where d.del_flag = ‘0’ order by d.parent_id, d.order_num

Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet successfully received from the server was 8,990 milliseconds ago. The last packet sent successfully to the server was 8,996 milliseconds ago.
; Communications link failure

The last packet successfully received from the server was 8,990 milliseconds ago. The last packet sent successfully to the server was 8,996 milliseconds ago.; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet successfully received from the server was 8,990 milliseconds ago. The last packet sent successfully to the server was 8,996 milliseconds ago.
at app.4163837c.js:1

【复现路径】做过哪些操作出现的问题
部署应用后,后端打开web访问系统会有概率出现以上JDBC连接丢失的问题

【问题现象及影响】
无法正常使用系统

请提供 jdbc 相关的连接配置信息 以及 tidb 相关的集群信息

官方文档是有一些问题说明的:


具体查看这个文档
开发 Java 应用使用 TiDB 的最佳实践 | PingCAP Docs

driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://HO:4001/ms_sys_db?useSSL=false&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&connectTimeout=60000&socketTimeout=60000

您好,这里配置了两次useSSL?是多配了useSSL=true?

还是你的眼神更锐利~~ :cowboy_hat_face:

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。