6

When I set useLegacyDatetimeCode=false in my JDBC connection properties, I get this error message:

java.sql.SQLException: The server timezone value 'CET' represents more than one timezone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc timezone value if you want to utilize timezone support. The timezones that 'CET' maps to are: Europe/Tirane, Europe/Andorra, Europe/Vienna, Europe/Minsk, Europe/Brussels, Europe/Sofia, Europe/Prague, Europe/Copenhagen, Europe/Tallinn, Europe/Berlin, Europe/Gibraltar, Europe/Athens, Europe/Budapest, Europe/Rome, Europe/Riga, Europe/Vaduz, Europe/Vilnius, Europe/Luxembourg, Europe/Malta, Europe/Chisinau, Europe/Tiraspol, Europe/Monaco, Europe/Amsterdam, Europe/Oslo, Europe/Warsaw, Europe/Lisbon, Europe/Kaliningrad, Europe/Madrid, Europe/Stockholm, Europe/Zurich, Europe/Kiev, Europe/Uzhgorod, Europe/Zaporozhye, Europe/Simferopol, Europe/Belgrade, Africa/Algiers, Africa/Tripoli, Africa/Casablanca, Africa/Tunis, Africa/Ceuta.

I understand what the message is telling me, but I'm not sure what to do about it. I don't have any way of knowing what time zone the MySQL server is running in (this is software that my customers install, and the servers are not managed by me).

I need to set this property to false to fix MySQL time zone bugs.

Jesse Barnum
  • 6,507
  • 6
  • 40
  • 69
  • It's a bug in the connector. Check this post: http://stackoverflow.com/questions/26515700/mysql-jdbc-driver-5-1-33-time-zone-issue/33893008#33893008 – Aníbal Nov 25 '15 at 11:17

1 Answers1

5

You need to pass an additional parameter like this:

db=jdbc:mysql://localhost/db?user=me&pass=secret&useLegacyDatetimeCode=false&serverTimezone=Europe/Vienna
Ari Maniatis
  • 8,038
  • 3
  • 19
  • 28