欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException异常处理

程序员文章站 2024-03-12 21:02:38
...

Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException异常处理org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException异常处理

  1. 检查你导入jar包的版本
    Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException异常处理

5.1.7.jar版本jdbc配置

jdbc.driver=com.mysql.cj.jdbc.Driver 
jdbc.url=jdbc:mysql://localhost:3306/shop

Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException异常处理
8.0.11.jar版本jdbc配置

jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true 

注:XML中“&”需要转义 “&

相关标签: 异常 jdbc