Exception in thread "main" Java.sql.SQLException:The Server time zone value '? й??????? ' is unrecognized or represents MOR E than one time zone.

Source: Internet
Author: User

Exception in thread "main" Java.sql.SQLException:The Server time zone value '? й??????? ' is unrecognized or represents MOR E than one time zone. You must configure either the server or JDBC driver (via the Servertimezone configuration) to use a more specifc Time zone value if you want to utilize time zone support.

Workaroundaccording to the exception prompt, you need to add the corresponding time zone, modify the URL can

String url = String.Format ("JDBC:MYSQL://%S:%D/%S?CHARACTERENCODING=%S&SERVERTIMEZONE=UTC", host, Port, database , encoding);

in XML

Indicates that there is an error in the system time zone and can execute commands in MySQL:

set global time_zone=‘+8:00‘ 
or add the SERVERTIMEZONE=UTC parameter after the database-driven URL

When writing the code, note that if the parameter is '? ' After the first one, that

<property name="jdbcUrl"> jdbc:mysql://localhost:3306/exam?serverTimezone=UTC </property>

is no problem, but if not the first one, that

<property name="jdbcUrl"> jdbc:mysql://localhost:3306/exam?characterEncoding=utf8&serverTimezone=UTC </property>

This writing will be error, will prompt the reference to entity "Servertimezone" must end with the '; ' delimiter.
The console will also appear after running
A reference to the entity "Servertimezone" must end with a '; ' delimiter.
The error prompt.
Change the code to

<property name="jdbcUrl"> jdbc:mysql://localhost:3306/exam?characterEncoding=utf8&amp;serverTimezone=UTC </property>

Can. In the XML configuration file; &amp;

Exception in thread "main" Java.sql.SQLException:The Server time zone value '? й??????? ' is unrecognized or represents MOR E than one time zone.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.