在spring联合mybatis时出现了以下错误
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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=utf-8&useSSL=false&serverTimezone=GMT’.
The error may exist in edu/td/dao/IProductDao.java (best guess)
The error may involve edu.td.dao.IProductDao.findAll
The error occurred while executing a query
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is 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=utf-8&useSSL=false&serverTimezone=GMT’.
说是连接数据库是url有问题
解决方案:
连接的mysql是8.0.19版本,首先更新mysql驱动到对应版本
在父类的pom文件
在xml文件里&符号它会让你转换成&+amp;
但在properties文件里它不会识别&+amp;
最后还是得用&
然后就成功了,mysql8+版本真麻烦