com.mysql.cj.jdbc.Driver问题和IDEA导入jar包

java问题修复

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

  • 错误原因及修改方法:
  1. 是因为后端MySQL版本在8.0及更高版本,在MySQL8.0前驱动为com.mysql.jdbc.Driver,8.0之后可以改为com.mysql.cj.jdbc.Driver
  2. 如果还是报Communications link failure这个错误,可以在修改jdbc为jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone = GMT

2. IntelliJ IDEA导入jar包

  1. 首先先下载好jar包( mybatis),点击Project Structure
    在这里插入图片描述2. 找到Dependencies,点击"+"
    在这里插入图片描述3. 选择JARS or directories
    在这里插入图片描述4. 找到Jar包路径,选择应用就行。
    在这里插入图片描述如图所示:
    在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/jiaona_chen123/article/details/114153169