Java连接MySQL报错:CommunicationsException: Communications link failure

现象:

报错:Exception in thread "main" com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

解决办法:

更换 mysql-connector-java-8.0.11.jar 为 mysql-connector-java-8.0.16.jar,

下载位置:https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.16

原因分析:

可能是 mysql-connector-java-8.0.11.jar 存在BUG,新版本8.0.16中被解决。

原文地址:https://www.cnblogs.com/jtzhang163/p/10891569.html

时间: 2024-08-28 20:19:09

Java连接MySQL报错:CommunicationsException: Communications link failure的相关文章

JDBC 报错 CommunicationsException: Communications link failure

|--报错内容 com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at com.mysql.cj.jdbc.exceptions

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 数据库报错

-- 查询mysql 数据库链接空闲时间持有最大空闲时间,单位为秒 SHOW VARIABLES WHERE VAriable_name = 'interactive_timeout'; -- 会出现wait_timeout与该参数意思相近,修改时,一起修改 SHOW VARIABLES WHERE VAriable_name = '%timeout'; -- 解决问题 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Commun

连接mysql报错java.sql.SQLException: The server time zone value '?й???????' is unrecognized...解决方法

报错内容: java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time

mysql 5.1超过默认8小时空闲时间解决办法(错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure)

报错: MySQL第二天早上第一次连接超时报错, com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 原因: 上述问题是由mysql5数据库的配置引起的.mysql5将其连接的等待时间(wait_timeout .interactive_timeout)缺省为8小时.在其客户程序中可以这样来查看其值: mysql> show global variables like 'wait

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

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at com.mysql.cj.jdbc.exceptions.SQLErro

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

启动Tomcat时,发生如下异常: DEBUG resourcepool.BasicResourcePool  - An exception occurred while acquiring a poolable resource. Will retry. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

1.错误描述 [ERROR:]2015-11-05 14:37:52,558 [插入失败] report.service.impl.ReportServiceImpl org.hibernate.exception.JDBCConnectionException: error executing work at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegat

解决:com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure(真实有效)

数据库连接失败 一.例如我在SpringBoot项目中使用了阿里的数据库连接池Driud. 有次在启动的时候,会报这样的错: Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure The last packet successfully received from the server was 319 milliseconds ago. The last packet s

异常解决com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

21:37:08,815 DEBUG BasicResourcePool:1831 - An exception occurred while acquiring a poolable resource. Will retry.com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was