0
点赞
收藏
分享

微信扫一扫

解决Springboot + MyBatis框架“Cause: org.springframework.jdbc.CannotGetJdbcConnectionException”问题

捡历史的小木板 2022-01-20 阅读 130
spring boot

目录

1 出错类型一(连接MySQL失败)

2 出错类型二(MySQL密码错误)

3 出错类型三(XXXMapper.xml中SQL语句语法问题) 


1 出错类型一(连接MySQL失败)

解决:重新安装mysql

2 出错类型二(MySQL密码错误)

 Bug:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
### The error may exist in file [D:\IdeaProjects\onlineExam\target\classes\mapper\UserMapper.xml]
### The error may involve com.nenusoftware.onlineexam.mapper.UserMapper.selectByName
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

解决:仔细查看Bug里面的Cause一行,检查用户名和密码是否正确

3 出错类型三(XXXMapper.xml中SQL语句语法问题) 

解决:检查sql语句是否正确

举报

相关推荐

0 条评论