NetBeans版本:8.2
mysql版本:8.0
Connector/J驱动程序:mysql-connector-java-8.0.16.jar
--------------------------------------------------------------------------------------------------------------
原JDBC URL: jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull
连接不成功,出错信息:
无法使用com.mysql.jdbc.Driver (The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.) 建立与jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull的连接
解决办法:
修改JDBC URL为:jdbc:mysql://localhost:3306/test?serverTimezone=UTC
同时,修改项目的context.xml配置文件,将 url="jdbc:mysql://localhost:3306/test" 改为 url="jdbc:mysql://localhost:3306/test?serverTimezone=UTC"
问题解决。
2019.6.25