Would an acceptable workaround for you to change the Java default timezone.
Either start the JVM with -Duser.timezone=GMT
or to invoke in your startup code TimeZone.setDefault(TimeZone.get("GMT"));
-Mikko
From: pgsql-jdbc-owner@postgresql.org <pgsql-jdbc-owner@postgresql.org> on behalf of Dave Cramer <pg@fastcrypt.com> Sent: 13 November 2014 16:27 To: George Woodring Cc: List Subject: Re: [JDBC] Anyway to tell jdbc to use server timezone?
Ah, OK, this was done for binary protocol. I seem to recall this is somewhat defined in the spec according to setTimestamp.
Is there a reason why you can't just override this in your code when you get a connection ?
It is not the where case that is my issue. It is that the jdbc driver is changing my timezone from what I set with alter database to the timezone of my web server for any queries from the web server. What I would like is a way to keep the database timezone setting.
When I log into my database with psql and show timezone I get "GMT", when I put a log into my java code and show timezone I get "US/Eastern". This is causing my data not to line up correctly around DST boundries, since the data was save at 12, 2, 4am GMT and it is trying to find data at 12, 2, 4am Eastern which is 12, 1, 3 am GMT
My question here is is there a way to disable it and get the older functionality? Is there a command I could run after I get the connection to say "set timezone = 'server default'"?