天天看點

mybatis遇到的問題

使用mybatis在連接配接資料庫遇到一個異常,

`Exception in thread “main” org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: 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.

The error may exist in com/ztb/config/sqlxml/Message.xml

The error may involve message.insert

The error occurred while executing an update

Cause: 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.

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)

at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)`

mybatis遇到的問題

可以看到有亂碼

在url加上

?characterEncoding=utf8

試試

mybatis遇到的問題

結果還是報錯

Cause: 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.

這次看到有什麼

time zone

什麼的,再次修改配置檔案,

serverTimezone=UTC

mybatis遇到的問題

這次可以運作了,不報錯了

繼續閱讀