<> Cause of the problem : Database driven mysql-connector-java8.0.16.jar The version of is higher , Here we use 8.0.16 explain
<> Problem description : Normally speaking, in mybatis The database configuration code written in is like this
<!-- Configure data source related properties and transactions --> <environments default="mysqlConn"> <!--
Multiple data source environments can be configured , Default use default Values in --> <environment id="mysqlConn"> <!-- use jdbc Business management of enterprise -->
<transactionManager type="JDBC" /> <!-- Configure data sources , And use the built-in database connection pool --> <dataSource type="
POOLED"> <property name="driver" value="com.mysql.jdbc.Driver" /> <property name
="url" value="jdbc:mysql://localhost:3306/testdb?characterEncoding=utf-8" /> <
property name="username" value="root" /> <property name="password" value="123"
/> </dataSource> </environment> </environments>
== It doesn't specify which Timezone( time zone ), So the following error will be reported .==
The server time zone value '?й???????' is unrecognized or represents more than
onetime 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 utilizetime zone support.
<> terms of settlement :
*
com.mysql.jdbc.Driver Replace with com.mysql.cj.jdbc.Driver
2.
jdbc:mysql://localhost:3306/testdb?characterEncoding=utf-8 Replace with
jdbc:mysql://localhost:3306/testdb?serverTimezone=UTC
there UTC It refers to the eighth East District
<!-- Configure data source related properties and transactions --> <environments default="mysqlConn"> <!--
Multiple data source environments can be configured , Default use default Values in --> <environment id="mysqlConn"> <!-- use jdbc Business management of enterprise -->
<transactionManager type="JDBC" /> <!-- Configure data sources , And use the built-in database connection pool --> <dataSource type="
POOLED"> <property name="driver" value="com.mysql.cj.jdbc.Driver" /> <property
name="url" value="jdbc:mysql://localhost:3306/testdb?serverTimezone=UTC" /> <
property name="username" value="root" /> <property name="password" value="123"
/> </dataSource> </environment> </environments>
<> Results display
There was no mistake !
<> The above is all the content of this article , I hope I can help you !!!
Technology