参见英文答案 > How to change MySQL timezone in a database connection using Java? 2个
使用JDBC连接到MysqL数据库时出现此错误.
Database.getConnection() Error -->The server time zone value 'EEST' 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.
那是我的连接代码.
public static Connection getConnection(){
try {
Class.forName("com.MysqL.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:MysqL://localhost:3306/management", "root", "root");
return con;
} catch (ClassNotFoundException | sqlException e) {
// Todo Auto-generated catch block
System.out.println("Database.getConnection() Error -->"
+ e.getMessage());
return null;
}
}
最佳答案:
我认为与MysqL和系统的不匹配时区存在问题.
因此,最好将值设置为同步.
您也可以参考以下链接来设置时间:How do I set the time zone of MySQL?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。