JDBC连接M有SQL数据库报错The server time zone value '???ú±ê×??±??' is unrecognized or represents........

利用JDBC连接数据时,会报错误具: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.具体错误如图所示:

解决办法:mysql返回的时间总有问题,一般总是早8小时。String url = "jdbc:mysql://localhost:3307/mysql_xy?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false";

即可。

猜你喜欢

转载自blog.csdn.net/plpldog/article/details/82794497
今日推荐