mySQL timezone different from client - Java
Posted by: Gisella Saavedra
Date: March 28, 2017 03:26PM

I have a 5.1 mySQL server where
SELECT @@global.time_zone, @@session.time_zone, @@system_time_zone;

A containerized application (in docker) is accessing this database, where the timezone is UTC.

The unix box's timezone where everything runs has timezone set to PDT.
Basically, db set to PDT, application set to UTC, and unix os env set to PDT.

Using spring 4 /Java8 and Connector/J 5.1.40

When I retrieve a timestamp field form the database, the field value does not reflect the real value.

In the app where the timezone is UTC, I get java.sql.TimeStamp value with an offset of 0 (it means UTC), but the time value is the PDT value, so when I try to convert it to a java8 ZOnedDateTime value, it thinks field value is already UTC.

Am I missing some settings for whether the jdbc connection string, or else?

ANy help I will appreciate.

Options: ReplyQuote

Written By
mySQL timezone different from client - Java
March 28, 2017 03:26PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.