背景:
Tomcat 7 で Java 1.6 Web アプリケーションを実行しています。データベースは MySQL 5.5 です。以前は、Mysql JDBC ドライバー 5.1.23 を使用して DB に接続していました。すべて正常に動作していました。最近、Mysql JDBC ドライバー 5.1.33 にアップグレードしました。アップグレード後、Tomcat はアプリケーションの起動時にこのエラーをスローします。
WARNING: Unexpected exception resolving reference
java.sql.SQLException: The server timezone value 'UTC' is unrecognized or 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.
なぜこうなった?
ベストアンサー1
どうやら、MySQL JDBC ドライバーのバージョン 5.1.33 を UTC タイムゾーンで動作させるには、serverTimezone
接続文字列で明示的に指定する必要があるようです。
jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC