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

导读:本篇文章讲解 Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

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

发生这个错误可能是url的路径写错了,也可能是mysql的服务忘记开启,所以检查mysql服务是否开启。

以下为我的配置与错误消息(我是忘记开服务,所以为connectionException 连接异常),供大家参考

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

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

 

SqlMapConfig.xml 全局配置

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

 

db.properties 配置

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

password是你自己数据库的密码。

mysql服务已开启

则去检查是否是URL的路径错误

这是没有db.properties配置的全局配置

SqlMapConfig.xml 全局配置

jdbc:mysql:///mybatisDb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai

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

 

 以上就是我的建议

注意:

mysql5.0的连接驱动是 com.mysql.jdbc.Driver

mysql8.0的连接驱动是com.mysql.cj.jdbc.Driver

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之家整理,本文链接:https://www.bmabk.com/index.php/post/88091.html

(0)
小半的头像小半

相关推荐

极客之家——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!