当前位置:Gxlcms > 数据库问题 > SQLException: The server time zone value '?й???????' is unrecognized 解决办法

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

时间:2021-07-01 10:21:17 帮助过:2人阅读


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   

人气教程排行