From: | Mikko Tiihonen <Mikko(dot)Tiihonen(at)nitorcreations(dot)com> |
---|---|
To: | Dave Cramer <pg(at)fastcrypt(dot)com>, George Woodring <george(dot)woodring(at)iglass(dot)net> |
Cc: | List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Anyway to tell jdbc to use server timezone? |
Date: | 2014-11-14 08:07:12 |
Message-ID: | 1415952431956.13439@nitorcreations.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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(at)postgresql(dot)org <pgsql-jdbc-owner(at)postgresql(dot)org> on behalf of Dave Cramer <pg(at)fastcrypt(dot)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 ?
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On 13 November 2014 08:31, George Woodring <george(dot)woodring(at)iglass(dot)net<mailto:george(dot)woodring(at)iglass(dot)net>> wrote:
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
Thanks
George
iGLASS Networks
www.iglass.net<http://www.iglass.net>
On Wed, Nov 12, 2014 at 1:59 PM, Dave Cramer <pg(at)fastcrypt(dot)com<mailto:pg(at)fastcrypt(dot)com>> wrote:
George,
I looked at the stackoverflow example. I fail to see how the driver would change the where clause.
Can you create a self contained test case ?
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On 12 November 2014 13:48, George Woodring <george(dot)woodring(at)iglass(dot)net<mailto:george(dot)woodring(at)iglass(dot)net>> wrote:
I originally asked a question about adjusting timezone per db back
1B1B254441DB31448BD34C5BD73B0B8B2904B1(at)PHOENIX(dot)istructure(dot)com<http://www.postgresql.org/message-id/1B1B254441DB31448BD34C5BD73B0B8B2904B1@PHOENIX.istructure.com>
And it was suggested that I set them per db, which I have. But now moving to
9.3 of the jdbc driver, it seems to set the timezone to the web server's timezone.
I have found mentions
CAAXGW-y==FOGGB7jVWhDsaugXV20qeXUcgZSiteQ7jfMXOKi-A(at)mail(dot)gmail(dot)com<http://www.postgresql.org/message-id/CAAXGW-y==FOGGB7jVWhDsaugXV20qeXUcgZSiteQ7jfMXOKi-A@mail.gmail.com>
and
http://stackoverflow.com/questions/18447995/postgresql-9-2-jdbc-driver-uses-client-time-zone
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'"?
Thanks
George Woodring
iGLASS Networks
www.iglass.net<http://www.iglass.net>
From | Date | Subject | |
---|---|---|---|
Next Message | George Woodring | 2014-11-14 13:31:55 | Re: Anyway to tell jdbc to use server timezone? |
Previous Message | Steven Schlansker | 2014-11-13 17:41:36 | Re: New significance of holdable result sets in Java 8 |