Connector/J and time zones

from the Artful MySQL Tips List

The MySQL server time zone (show variables like 'time_zone';) is usually set to SYSTEM, the operating system time zone. Windows timezones, though, don't follow the Internet Assigned Numbers Authority (IANA) naming protocol, so Connector/J has to try to figure out the time zone from a static mapping. Sometimes it can't, then the connection fails.

To work around this, either set "serverTimezone=name_of_your_time_zone" in Connector/J connection string, or set the MySQL server variable time_zone with a valid IANA name, e.g., set global time_zone='Asia/Kuala_Lumpur' in my.ini.

Last updated 16 Aug 2019

Return to the Artful MySQL Tips page