栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

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

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

目录

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

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

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


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

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'root'@'127.0.0.1' to database 'db_onlineexam'

解决:重新安装mysql

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

### 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:

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:IdeaProjectsonlineExamtargetclassesmapperUserMapper.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语句是否正确

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/708302.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号