MyBatis连接MySQL8.0.20报错No suitable driver found for jdbc:mysql//localhost:3306/mybatis?serverTimezone

在使用MyBatis连接MySQL8.0.20时遇到错误'No suitable driver found for jdbc:mysql//localhost:3306/mybatis?serverTimezone'。经过排查,问题出在一个多余的':'上。修正后的正确连接写法解决了问题,提醒开发者注意此类细节。
摘要由CSDN通过智能技术生成

最近这个bug困扰了我两天,上网一直找不到答案,一直提示我没有合适的驱动去加载,起初我还以为是不是我的数据库版本太高了,要不要考虑换个低一点的版本。报错具体如下:

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLException: No suitable driver found for jdbc:mysql//localhost:3306/mybatis?serverTimezone=UTC&characterEncoding=utf-8
### The error may exist in com/Dao/UserDao.xml
### The error may involve com.Dao.UserDao.findAll
### The error occurred while executing a query
### Cause: java.sql.SQLException: No suitable driver found for jdbc:mysql//localhost:3306/mybatis?serverTimezone=UTC&characterEncoding=utf-8
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
	at org.apache
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值