英文:
java.sql.SQLException: The server time zone value - connecting using port and name
问题
我正在填写我的应用程序中的一些文本字段,并希望将它们发送到数据库"appforhh"。但是我收到了以下错误:
> java.sql.SQLException: 服务器时区值'RTZ 2 (����)'无法识别或表示多个时区。如果要使用时区支持,您必须配置服务器或JDBC驱动程序(通过'serverTimezone'配置属性)以使用更具体的时区值。
我尝试在MySQL中执行 SET GLOBAL time_zone = '+3:00';,但没有任何变化。
public class DataBaseHandler extends Configs {
Connection dbConnetion;
public Connection getDbConnetion() throws ClassNotFoundException, SQLException {
String connectionString = "jdbc:mysql://" //连接字符串
+ dbHost + ":"
+ dbPort + "/"
+ dbName;
Class.forName("com.mysql.cj.jdbc.Driver");
dbConnetion = DriverManager.getConnection(connectionString, dbUser, dbPass);
return dbConnetion;
}
}
英文:
I'm filling in some text fields in my app and want to send them to the database "appforhh". But I get the error:
> java.sql.SQLException: The server time zone value 'RTZ 2 (����)' 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.
I tried SET GLOBAL time_zone = '+3:00'; in mySQL, but nothing changed.
public class DataBaseHandler extends Configs {
Connection dbConnetion;
public Connection getDbConnetion() throws ClassNotFoundException, SQLException {
String connectionString = "jdbc:mysql://" //Connection String
+ dbHost + ":"
+ dbPort + "/"
+ dbName;
Class.forName("com.mysql.cj.jdbc.Driver");
dbConnetion = DriverManager.getConnection(connectionString, dbUser, dbPass);
return dbConnetion;
}
专注分享java语言的经验与见解,让所有开发者获益!
评论