参考:https://www.w3cschool.cn/wkspring/iuck1mma.html
使用包含 Spring JDBC 的库
mysql-connector-java.jar -> mysql-connector-java-8.0.11.jar
org.springframework.jdbc.jar -> spring-jdbc-5.0.7.RELEASE.jar
org.springframework.transaction.jar -> spring-tx-5.0.7.RELEASE.jar
或者使用包含 c3p0 的库
mysql-connector-java-8.0.11.jar
c3p0-0.9.5.2.jar
mchange-commons-java-0.2.11.jar
<property name="url" value="jdbc:mysql://localhost:3306/TEST?useSSL=false&serverTimezone=GMT"/>
1.在 xml 中的 & 要用 & 来代替
2.要设置 useSSL=false 或者 useSSL=true,根据自己电脑实际配置来设置,一般两者都行,我的电脑用了 IIS 目前只能用 false
3.要设置 serverTimezone=GMT,或者其他合理的值
可解决以下问题
The server time zone value ‘XXX’ is unrecognized or represents more than one time zone.
Establishing SSL connection without server's identity verification is not recommended.
The reference to entity “XXX” must end with the ‘;’ delimiter.
本文介绍了如何使用 Spring JDBC 进行数据库连接配置,包括使用 mysql-connector-java 和 c3p0 连接池的不同配置方式。重点在于正确的配置文件路径、SSL 设置以及时区参数。
798

被折叠的 条评论
为什么被折叠?



