spring | 踩坑 | Could not get JDBC Connectionl nested exception is java.sql.SQLException...

问题描述

使用IDEA用maven管理项目,使用spring+jdbc连接数据库,最后编写测试类运行后
出现如下错误

问题重现

Could not get JDBC Connectionl nested exception is java.sql.SQLException...

Connections could not be acquired from the underlying database!

spring | 踩坑 | Could not get JDBC Connectionl nested exception is java.sql.SQLException...

问题分析

根据网络上的解答教程,可知此问题的原因是
mysql数据库驱动和mysql数据库版本不一致,具体配置是
mysql为V 8.0.21,mysql-connector-drive是V 5.1.6

问题解决

使用maven 修改配置文件,将mysql-connector版本改为8.0.21即可


?? 注: 是的在新版的驱动中
新增cj

spring | 踩坑 | Could not get JDBC Connectionl nested exception is java.sql.SQLException...
使用jdbc下的Driver也行

spring | 踩坑 | Could not get JDBC Connectionl nested exception is java.sql.SQLException...

上一篇:DB DBMS SQL关系以及表的理解


下一篇:mysql传统复制传输表空间遇到的坑