MyBatis错误:
Cannot load connection class because of underlying exception
properties属性
创建的db.properties文件注意URL的格式:
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/jdbcstudy?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=CST
username=root
password=123456
在mybatis-config.xml文件中:
在db.properties文件中:
注意要去掉;
不然报错:
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near ';characterEncoding=utf8&useSSL=true&serverTimezone=CST'.
### The error may exist in com/wei/Dao/UserMapper.xml
### The error may involve com.wei.Dao.UserDao.findAllUser
### The error occurred while executing a query
### Cause: java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near ';characterEncoding=utf8&useSSL=true&serverTimezone=CST'.