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&serverTimezone=UTC </property>
Can. In the XML configuration file; &
Exception in thread "main" Java.sql.SQLException:The Server time zone value '? й??????? ' is unrecognized or represents MOR E than one time zone.