From 9f0b83a603946e46eb898b4e03236f4c80013f74 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sat, 18 Apr 2026 17:26:54 -0700 Subject: [PATCH] Revert "Tell JDBC to use UTC when converting timestamp." This reverts commit 54afc8490a9418b8290c4b2ff0e03ed9e7da8395. Good lord. Apparently we don't want this. MySQL will _still_ interpret the timestamp that we send using the connection timezone, which may or may not be UTC. The _only_ way to ensure sanity is to pin the timezone on the JDBC connection. Sigh. I cannot believe that in the year of our lord twenty twenty six, we are formatting dates and times into strings and sending those to databases. --- .../java/com/samskivert/jdbc/jora/FieldDescriptor.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/samskivert/jdbc/jora/FieldDescriptor.java b/src/main/java/com/samskivert/jdbc/jora/FieldDescriptor.java index e67b3d94..cbb95d13 100644 --- a/src/main/java/com/samskivert/jdbc/jora/FieldDescriptor.java +++ b/src/main/java/com/samskivert/jdbc/jora/FieldDescriptor.java @@ -8,8 +8,6 @@ package com.samskivert.jdbc.jora; import java.sql.*; import java.math.*; import java.lang.reflect.*; -import java.util.Calendar; -import java.util.TimeZone; class FieldDescriptor { @@ -101,7 +99,7 @@ class FieldDescriptor pstmt.setTime(column, (java.sql.Time)field.get(obj)); break; case tTimestamp: - pstmt.setTimestamp(column, (java.sql.Timestamp)field.get(obj), UTC_CALENDAR); + pstmt.setTimestamp(column, (java.sql.Timestamp)field.get(obj)); break; case tStream: java.io.InputStream in = (java.io.InputStream)field.get(obj); @@ -327,7 +325,7 @@ class FieldDescriptor field.set(obj, result.getTime(column)); break; case tTimestamp: - field.set(obj, result.getTimestamp(column, UTC_CALENDAR)); + field.set(obj, result.getTimestamp(column)); break; case tStream: field.set(obj, result.getBinaryStream(column)); @@ -419,7 +417,4 @@ class FieldDescriptor Types.VARCHAR, // tAsString Types.LONGVARBINARY // tClosure }; - - /** A UTC calendar used to ensure timezone-correct Timestamp binding and loading. */ - private static final Calendar UTC_CALENDAR = Calendar.getInstance(TimeZone.getTimeZone("UTC")); }