Bill>When I try to insert via JDBC, the time is always adjusted for the
Bill>JVM's time zone. This behavior seems wrong to me
Bill>// Java code:
Bill>preparedStatement.setTime(1, Time.valueOf("00:00:10"));
A no-brain answer is: you do not provide the time zone, thus the
driver uses "current time zone".
What's wrong with that?
Note: java.sql.Time does not store "dd, hh, mm" in a separate fields.
It always converts to "milliseconds since...", thus it is doomed to
run into timezones.
Have you tried org.postgresql.jdbc.PgPreparedStatement#setTime(int,
java.sql.Time, java.util.Calendar)?
Alternative solution would be to use java.time.LocalTime -- it could
be easier to reason about.
More specific example would help to tell if the behavior is expected or not.
Can you share that?
Vladimir