MySQL JDBC Driver 5.1.33 - Time Zone Issue
If you are using MySQL JDBC Driver version 5.1.33 and you are experiencing issues with time zones, there are a few things you can try:
Make sure that your MySQL server is using the correct time zone. You can check this by running the following command:
SELECT @@global.time_zone, @@session.time_zone;
If the time zones are not set correctly, you can set them using the following commands:
SET @@global.time_zone = 'UTC'; SET @@session.time_zone = 'UTC';
Make sure that your JDBC URL is using the correct time zone. You can do this by adding
useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTCto your JDBC URL.
If you are using a Java version before 8u60, you can use the
serverTimezoneproperty in the JDBC URL to specify the time zone. For example:
I hope these suggestions help! Let me know if you have any other questions.