刚学习mybatis的菜鸟,第一个入门案例就把能遇到的错误都报了一遍,真的服了呀,真的好菜
1. 第一个
Error querying database. Cause: java.sql.SQLException: No suitable driver found
出错的原因:数据库的路径写错了
闲下面的麻烦,我一般改为 jdbc:mysql://l/mybatis
<property name="url" value="jdbc:mysql://localhost:3306/mybatis"/>
2. 第二个
Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource cn.com.dao.IUserDao.xml
把指定映射配置文件的位置写错,正确写法
mapper resource="cn/com/dao/IUserDao.xml"
自己写成 mapper resource="cn.com.dao.IUserDao.xml"
3. 第三个
报错如下:
Cause: org.apache.ibatis.executor.ExecutorException:
A query was run and no Result Maps were found for the Mapped Statement 'cn.com.dao.IUserDao.findAll'.
It's likely that neither a Result Type nor a Result Map was specified.
原因是没有将查询的结果封装到User内,没有加上
入门的案例就出现这么多错误,真不知道怎么说自己,得记录下这个傻傻的自己