Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException异常处理
程序员文章站
2024-03-12 21:02:38
...
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException异常处理
- 检查你导入jar包的版本
5.1.7.jar版本jdbc配置
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/shop
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中“&
”需要转义 “&
”