My table has a TIMESTAMP column. Per our convention all times in the db is supposed to be in 'UTC'.
When I insert a java.util.Date it is converted using the JVM's default TimeZone.
There seems to be no way to specify the TimeZone on session / connection level.
Oracle JDBC supports this by calling
oracleConnection.setSessionTimeZone("UTC");
Postgres JDBC seems to allow this by calling
set timezone to 'UTC'; using the JDBC driver.
However, this does not have any effect. It is always the JVM's default time zone that determines how the conversion occurs.
The only solution I came up with is specifying a Calendar with UTC time zone when binding the java.util.Date to the PreparedStatement.