赞
踩
用mybatis框架写propertities文件的时候报出以下错误:
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 ';useUnicode=true&characterEncoding=utf8&useUnicode=true'.
我的propertities文件和config.xml文件如下:
mysql版本是8.0,jdk8.0.11
经过查找后发现是8.0版本不能识别&;的字符,只要将url=jdbc:mysql://127.0.0.1:3306/mybatis_db?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useUnicode=true改成url=jdbc:mysql://127.0.0.1:3306/mybatis_db?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useUnicode=true就可以了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。