本文链接:https://blog.csdn.net/qq_43657590/article/details/102861733
我们都知道MySQL8连接数据库改了
需要使用url=”jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC”;
driverClass=“com.mysql.cj.jdbc.Driver”;
但是在配置文件中却报错了
[Fatal Error] :5:90: 对实体 "serverTimezone" 的引用必须以 ';' 分隔符结尾。
十一月 01, 2019 5:33:32 下午 com.mchange.v2.c3p0.cfg.C3P0Config
警告: XML configuration disabled! Verify that standard XML libs are available.
org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 90; 对实体 "serverTimezone" 的引用必须以 ';' 分隔符结尾。
解决方法如下:把
jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC
改成
jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
最后的基础配置文件为
<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<default-config><!-- 默认配置 -->
<property name="driverClass">com.mysql.cj.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true</property>
<property name="user">root</property>
<property name="password">203031</property>
</default-config>
<named-config name="abcd">
<property name="driverClass">com.mysql.cj.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true</property>
<property name="user">root</property>
<property name="password">203031</property>
</named-config>
</c3p0-config>