The time zone CST has different meanings on MySQL Server and on conntector/j
Posted by: Wu Qiming
Date: May 22, 2017 07:48PM

I have a MySQL Server installed on Linux. The timezone of the Linux is CST which means China Standard Time. But the CST explain as Central Standard Time in java side.

I looked at the source code, the CST is read from /etc/localtime file at server side. And com.mysql.cj.mysqla.MysqlaSession.configureTimezone() read the system_time_zone variable from the server side in connector/j v6.0.x. com.mysql.cj.jdbc.util.TimeUtil.loadTimeZoneMappings(ExceptionInterceptor) initialize all time zones to timeZoneMappings variable use properties file and java.util.TimeZone.getAvailableIDs(). In java.util.TimeZone, CST means Center Standard Time which has 13 or 14 hours behind China Standard Time.

I think it is a serious defect. I suggest should MySQL use offset to represent a timezone instead of using a string format. Or if want fix the defect quickly, should simplely add a line "CST=Asia/Shanghai" to /com/mysql/cj/jdbc/util/TimeZoneMapping.properties file.

Options: ReplyQuote


Subject
Written By
Posted
The time zone CST has different meanings on MySQL Server and on conntector/j
May 22, 2017 07:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.