JDBC corrupts TIMESTAMP WITH LOCAL TIME ZONE at daylight saving changeover
510015Mar 20 2008 — edited Mar 25 2008I have found the Oracle JDBC ResultSet.getTimestamp returns incorrect values (incorrectly adjusted by 1 hour) for values retrieved from TIMESTAMP WITH LOCAL TIME ZONE columns, when the value is close to the daylight saving transitions of the client time zone. Saving the values back to the database results in a changed value. I am using database time zone = GMT. If tzoffset it the local time zone offset from GMT and is positive, values are incorrect for tzoffset hours before the DST transition time and one hour after it. If tzoffset it negative then values are incorrect for -tzoffset hours after the DST transition. If your database time zone is closer to your local time, then the effect is reduced.
Affected times: In time zones which are GMT plus something, the effect can only apply to timestamps on Saturday afternoon or early Sunday. In time zones which are GMT minus something, it can only affect times early on Sunday, so if you do not use TIMESTAMP WITH LOCAL TIME values in those ranges, you will not be affected.
Affected JDBC versions: Oracle JDBC drivers (10.1, 10.2, 11.1)
I reported this to Oracle on Jan 7 2008, and escalated it in late Jan, but no fix has been forthcoming - they have found the problems, but not finished back porting or issued patches. Since the Daylight Savings start and end times are approaching, I thought I would let people know of the issue. It is Metalink Bug 6749302 and non-public bug 6868399.
I have workaround routines that can retrieve the value as an Oracle TIMESTAMPLTZ object and correctly convert that into a java.sql.Timestamp object. If you need them, let me know by replying here.
I am also wondering whether I am the only person using TIMESTAMP WITH LOCAL TIME ZONE via JDBC for 24*7 operations - is anyone else doing this?