码迷,mamicode.com
首页 > 数据库 > 详细

SQLException: The server time zone value '?й???????' is unrecognized 解决办法

时间:2020-06-05 21:21:55      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:err   ons   pre   new   mysqld   rac   java   char   nim   

Exception in thread "main" java.sql.SQLException: 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.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:416)
at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:128)
at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:113)
at test.jar_test.main(jar_test.java:51)

解决办法:连接数据库时:

((MysqlDataSource) dataSource).setURL("jdbc:mysql://127.0.0.1:3306/mysql1?characterEncoding=utf-8&useSSL=true");
修改为:
((MysqlDataSource) dataSource).setURL("jdbc:mysql://127.0.0.1:3306/mysql1?serverTimezone=UTC&useSSL=true");

SQLException: The server time zone value '?й???????' is unrecognized 解决办法

标签:err   ons   pre   new   mysqld   rac   java   char   nim   

原文地址:https://www.cnblogs.com/jicongcong/p/13051693.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!