JDBC数据库链接:Communications link failure失败
初次链接JDBC遇到:Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure。
数据库链接失败的原因有以下:URL错误;用户名错误;密码错误。
String url = "jdbc:mysql://localhost:3306/jdbcStudy?useUnicode=true&characterEncoding=utf8&useSSL=true";
String username = "root";
String password = "123456";
我的用户名和密码都正确,将url的安全套接字协议useSSL设置成false。
因为JDBC在mysql进行连接的时候,如果mysql的版本是5.7之后的版本必须要加上useSSL=false,mysql5.7以及之前的版本则不用进行添加useSSL=false,会默认为false,一般情况下都是使用useSSL=false。
解决后:
String url = "jdbc:mysql://localhost:3306/jdbcStudy?useUnicode=true&characterEncoding=utf8&useSSL=false";
String username = "root";
String password = "123456";
JDBC数据库链接:Communications link failure失败相关推荐
- mac之idea连接MySQL数据库报com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
项目场景: 最近入手了一台MacBookPro(谨慎尝试,用惯了windos后使用感具别扭,需要大量时间来适应),下载了最新的idea和最新的mysql8.0.23,然后开始了漫长而艰辛的开始,各种没 ...
- Underlying cause: com.mysql.cj.jdbc.exceptions.CommunicationsException : Communications link failure
Hive试图schematool -dbType mysql -initSchema时候报错如下: Metastore connection URL: jdbc:mysql://Desktop ...
- com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure 数据库jdbc连接异常,数据库连接异 ...
- Druid 连接池 报错 com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
场景赘述 早晨查看项目前一天的实际运行日志,发现了 一个Springboot项目中的druid 连接池和 mysql 产生了异常信息,重连暂并未对系统产生影响 下面是具体报错信息: com.mysql ...
- 连接数据库报错com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure的解决方法
控制台报错 Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure com. ...
- 【Linux 报错】com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The las
报错信息如下: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failureThe last pa ...
- 解决:com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure(真实有效)
数据库连接失败 在数据库连接失败,经常会有蛮多一系列的问题导致的原因,这个时候一定要多去尝试一下各种方法,并且做好自己的梳理! 一.例如我在SpringBoot项目中使用了阿里的数据库连接池Driud ...
- Rejecting re-init Communications link failure
@[TOC](Rejecting re-init on previously-failed class java.lang.Class<com.mysql.cj.MysqlType>: j ...
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 数据库报错
-- 查询mysql 数据库链接空闲时间持有最大空闲时间,单位为秒 SHOW VARIABLES WHERE VAriable_name = 'interactive_timeout'; -- 会出现 ...
最新文章
- 在vue中let var 和const 区别
- 重整谋定电商经信研究新格局-李玉庭:人工智能精细化运营
- Linux设置路由器ip租约时间,入坑Linux-day15(使用DHCP动态管理主机地址)
- MySQL / B + 树算法在 mysql 中能存多少行数据?
- Jdbc访问mysql查询聚合函数_JDBC连接参数设置对Oracle数据库的影响分析
- QPixmap QImage 相互转化
- java 获取所有带指定注解的类名_SXT DAY023 反射和注解
- [Vo. 1 No. 1] 高等代数一题[Sep. 19, 2013]
- UVA1437 String painter
- 解密Oracle备份工具-exp/imp
- 将矩阵转为一行_理解矩阵乘法
- android 加载系统私有库,Android 搭建私有maven仓库及上传项目
- matlab 命令集结(1)
- Linux 下的任务管理 —— ps、top
- 最近学习安卓中总结的一些知识点
- 小车手app安卓版下载_美森网校app下载_美森网校安卓版下载[英语培训]
- 电脑需要装杀毒软件吗?两个理由看完你做决定
- 新浪微博的架构发展历程
- JavaScrpit+Html实现日期时间启动、停止操作(应用场景:计时器、秒表)
- Objective C 常用代码片段制作(code snippet library)