当前位置:   article > 正文

mybatis报错 Cause: java.sql.SQLNonTransientConnectionException: Cannot load connection class because o

java.sql.sqlnontransientconnectionexception: cannot load connection class be

用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就可以了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/正经夜光杯/article/detail/898691
推荐阅读
相关标签
  

闽ICP备14008679号