Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The server time zone value

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Exception description

Exception in thread "main" java.sql.SQLException: The server time zone value'? host ±host 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.

JDBC connects to mysql using .connector.6.0.jar

Problem solving:

String url = "jdbc:mysql://localhost:3306/zdx?serverTimezone=UTC"

Add? serverTimezone=UTC after url

As follows:

String url = "jdbc:mysql://localhost:3306/zdx?serverTimezone=UTC"

Hint: Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

This problem is not an error, it's just a friendly hint. If you don't want it, mysql can automatically load the driver in 6. 0 jar.

That is,

Class.forName ("com.mysql.jdbc.Driver"); if this sentence is commented out, the prompt will not appear again.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report