MySQL JDBC Driver Time Zone Issue with Version 5.1.33
After upgrading to the MySQL JDBC driver version 5.1.33, a Java application running on Tomcat 7 encounters an error upon startup. The error message indicates an issue with the server timezone being unrecognized or representing multiple timezones.
This error occurs because version 5.1.33 of the MySQL JDBC driver requires the server time zone to be explicitly specified in the connection string. Previously, in version 5.1.23, this was not necessary.
To resolve the issue, explicitly specify the server time zone in the connection string, such as:
jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
By specifying the server time zone (in this case, UTC), the MySQL JDBC driver will be able to correctly handle time zone adjustments and avoid the unexpected exception.
The above is the detailed content of Why Does My Java App Fail to Start After MySQL JDBC Driver 5.1.33 Upgrade?. For more information, please follow other related articles on the PHP Chinese website!