您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

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

bubuko 2022/1/25 19:05:33 java 字数 1232 阅读 768 来源 http://www.bubuko.com/infolist-5-1.html

问题描述 使用IDEA用maven管理项目,使用spring+jdbc连接数据库,最后编写测试类运行后 出现如下错误 问题重现 Could not get JDBC Connectionl nested exception is java.sql.SQLException... Connection ...

问题描述

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

问题重现

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

Connections could not be acquired from the underlying database!

image

问题分析

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

问题解决

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


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

image
使用jdbc下的Driver也行

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

原文:https://www.cnblogs.com/martin-1/p/14824052.html


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶