0

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.