Failed to obtain JDBC Connection; nested exception
时间:2023-01-18
浏览:379
作者:佚名
哈喽!今天心血来潮给大家带来了《Failed to obtain JDBC Connection; nested exception》,想必大家应该对数据库都不陌生吧,那么阅读本文就都不会很困难,以下内容主要涉及到MySQL、springboot、mysql-connector,若是你正在学习数据库,千万别错过这篇文章~希望能帮助到你!
author: Nathannie
date: 2022-03-26-23:29
问题背景
spingboot整合mybatis过程中启动spingboot报错。
报错信息
报错内容:
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 '***'@'localhost' (using password: YES) ### The error may exist in com/itheima/springbootmybatis/mapper/UserMapper.java (best guess) ### The error may involve com.itheima.springbootmybatis.mapper.UserMapper.findAll ### 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 '***'@'localhost' (using password: YES)
报错定位:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
mysql版本问题
8.0以后的版本使用com.mysql.cj.jdbc.Driver驱动,添加了spring: datasource: url: jdbc:mysql:///springboot?serverTimezone=GMT username: root password: 123456 driver-class-name: com.mysql.cj.jdbc.Driver相关参考
终于介绍完啦!小伙伴们,这篇关于《Failed to obtain JDBC Connection; nested exception》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布数据库相关知识,快来关注吧!
本文内容来源于互联网,如有侵权请联系删除。
近期热门
11.18
11.15
站内热门
最新文章
11.27
热门专题
