Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
3.0.4
-
None
-
None
-
None
Description
Hi,
moving from v2.7.5 to v3.0.4 raises a bug in our system where a queried TIMESTAMP column returns java.sql.Timestamp with wrong time zone.
Flow:
1. DB server runs with @@global.time_zone = SYSTEM and system_time_zone = UTC.
2. insert TIMESTAMP value using CURRENT_TIMESTAMP/Now() - when observing the DB using external tool (i.e. DBeaver which uses 2.7.1 driver) shows the timestamp column has correct value (the current time in UTC, i.e. 13:00:00)
3. from a machine/jvm with different time zone (i.e. GMT+2) and driver version 3.0.4:
a. query for the TIMESTAMP column using jdbcTemplate
b. observer the returned value (java.sql.Timestamp type) - the time is the same as in DB but with GMT+2 timezone (i.e. 13:00:00+0200)
4. repeating above but in step 3 using driver v2.7.5 returns the time as expected (i.e. 15:00:00+0200)
Observing the diff between v3.0.4 and v2.7.5 - it seems that 3.0.4 has a bug in Result.java:getObject(int columnIndex): the impl always pass cal: null which eventually cause the TimestampCodec to fill DB UTC value into local timezone colander.
In v2.7.5 the implementation is different and the SelectResultSet.java:getObject pass timeZone parameter correctly.