2020-10-09

在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+版本真麻烦

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值