Exception in thread “main“ org.apache.ibatis.exceptions.PersistenceException: ### Error querying da

写的关于查询花店数据库的简单案例

问题描述:

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find class: com.mysql.cj.jdbc.Driver
### The error may exist in per/mapper/FlowerMapper.xml
### The error may involve per.mapper.FlowerMapper.selectMore
### The error occurred while executing a query
### Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot find class: com.mysql.cj.jdbc.Driver

Exception in thread “main“ org.apache.ibatis.exceptions.PersistenceException: ### Error querying da_第1张图片


原因分析:

从报错信息来看,是驱动没有加载到。
然后看了看我得驱动,应该是版本太低了
Exception in thread “main“ org.apache.ibatis.exceptions.PersistenceException: ### Error querying da_第2张图片


解决方案:

找同学要了个8点几高版本的mysql驱动的jar包,重新添加到lib(add as library)
Exception in thread “main“ org.apache.ibatis.exceptions.PersistenceException: ### Error querying da_第3张图片

你可能感兴趣的:(Java全栈,apache,mysql,数据库)