Bug #93091 MySQLD On Localized Windows OS doesn't work with Connector J 8.x.x
Submitted: 6 Nov 2018 4:30 Modified: 8 Apr 2019 11:16
Reporter: Katsumi Yokomichi Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:8.0.15 OS:Windows
Assigned to: CPU Architecture:Any

[6 Nov 2018 4:30] Katsumi Yokomichi
Description:
On localized Windows OS (confirmed on Japanese and French), Connector J 8.x can't connect to default setting MySQLD.

It's because system time zone setting on localized Windows is localized since OS report localized time zone name.
Connector J 8.x has time zone mapping table in it (TimeZoneMapping.properties) but that doesn't recognize localized time zone name.

mysql> select @@system_time_zone;
+--------------------+
| @@system_time_zone |
+--------------------+
| Paris, Madrid      |
+--------------------+
1 row in set (0.00 sec)

java.sql.SQLException: The server time zone value 'Paris, Madrid' 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 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
	at TestMain.main(TestMain.java:11)
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Paris, Madrid' 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 java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
	at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
	at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2234)
	at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2258)
	at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
	... 6 more

workaround is not to use SYSTEM time zone.
Setup timezone table and specify default-time-zone like this.

[mysqld]
default-time-zone='Asia/Tokyo'

How to repeat:
1. set up mysqld on localized Windows OS. (I used Windows 10 1803).
2. Connect from Connector J 8.x.x. Connector J 5.x.x works well.

Suggested fix:
I believe this is Windows OS over localized bug. But also I know this can't be fixed by OS since it's already widely distributed and impact is too big.

I think Std and Dlt value should not be localized.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones

If MySQL server need to be fixed, TimeZoneMapping.properties have to have all localized time zone name for mapping.
[8 Apr 2019 11:16] MySQL Verification Team
Hello Katsumi-San,

Thank you for the report.
Imho this is duplicate of Bug #94257, please see Bug #94257(ideally, newer should be duplicate but since Bug #9425 is verified already hence marking this as duplicate of newer one i.e Bug #9425).

regards,
Umesh