java.sql.SQLException: The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represents more tha

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.(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
at com.hspedu.qqclient.util.JdbcUtil.getConnection(JdbcUtil.java:23)
at com.hspedu.qqclient.util.JdbcUtil.dataConnectionPool(JdbcUtil.java:35)
at com.hspedu.qqclient.view.QQView.mainMenu(QQView.java:27)
at com.hspedu.qqclient.view.QQView.main(QQView.java:24)

问题是jdbc版本问题,在url后面加上这句话就可以了useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
最终效果是这样的:jdbc:mysql://localhost:3306/bjpowernode?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC


版权声明:本文为qq_50504109原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。