Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XpCCl-000739-DD for pgsql-jdbc@arkaria.postgresql.org; Fri, 14 Nov 2014 08:26:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XpCCj-0000cH-R5 for pgsql-jdbc@arkaria.postgresql.org; Fri, 14 Nov 2014 08:26:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XpCCi-0000c9-OL for pgsql-jdbc@postgresql.org; Fri, 14 Nov 2014 08:26:04 +0000 Received: from mail-am1on0621.outbound.protection.outlook.com ([2a01:111:f400:fe00::621] helo=emea01-am1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XpCCd-00058t-G7 for pgsql-jdbc@postgresql.org; Fri, 14 Nov 2014 08:26:03 +0000 Received: from AM2PR07MB0659.eurprd07.prod.outlook.com (25.160.55.150) by AM2PR07MB0658.eurprd07.prod.outlook.com (25.160.55.15) with Microsoft SMTP Server (TLS) id 15.1.16.15; Fri, 14 Nov 2014 08:07:13 +0000 Received: from AM2PR07MB0659.eurprd07.prod.outlook.com ([25.160.55.150]) by AM2PR07MB0659.eurprd07.prod.outlook.com ([25.160.55.150]) with mapi id 15.01.0016.006; Fri, 14 Nov 2014 08:07:13 +0000 From: Mikko Tiihonen To: Dave Cramer , George Woodring CC: List Subject: Re: Anyway to tell jdbc to use server timezone? Thread-Topic: [JDBC] Anyway to tell jdbc to use server timezone? Thread-Index: AQHP/qlNuxZaZwWrhUSa470AqnD91pxdWCCAgAE2tYCAAA+rgIABJuSg Date: Fri, 14 Nov 2014 08:07:12 +0000 Message-ID: <1415952431956.13439@nitorcreations.com> References: , In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [83.145.228.24] x-microsoft-antispam: BCL:0;PCL:0;RULEID:;SRVR:AM2PR07MB0658; x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:;SRVR:AM2PR07MB0658; x-forefront-prvs: 03950F25EC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(199003)(189002)(24454002)(377454003)(87936001)(2656002)(120916001)(92566001)(92726001)(575784001)(86362001)(107046002)(99396003)(117636001)(21056001)(46102003)(36756003)(15202345003)(31966008)(16601075003)(19580395003)(19580405001)(106116001)(105586002)(95666004)(4396001)(15975445006)(106356001)(15395725005)(16236675004)(101416001)(19627405001)(19617315012)(64706001)(40100003)(76176999)(54356999)(20776003)(93886004)(97736003)(50986999)(77096003)(77156002)(66066001)(122556002)(62966003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR07MB0658; H:AM2PR07MB0659.eurprd07.prod.outlook.com; FPR:; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Content-Type: multipart/alternative; boundary="_000_141595243195613439nitorcreationscom_" MIME-Version: 1.0 X-OriginatorOrg: nitorcreations.com X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org --_000_141595243195613439nitorcreationscom_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Would an acceptable workaround for you to change the Java default timezone. Either start the JVM with -Duser.timezone=3DGMT or to invoke in your startup code TimeZone.setDefault(TimeZone.get("GMT")); -Mikko ________________________________ From: pgsql-jdbc-owner@postgresql.org on = behalf of Dave Cramer 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 somewha= t defined in the spec according to setTimestamp. Is there a reason why you can't just override this in your code when you ge= t a connection ? Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 13 November 2014 08:31, George Woodring > wrote: It is not the where case that is my issue. It is that the jdbc driver is c= hanging 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 d= ata 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 On Wed, Nov 12, 2014 at 1:59 PM, Dave Cramer > wrote: George, I looked at the stackoverflow example. I fail to see how the driver would c= hange 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 > wrote: I originally asked a question about adjusting timezone per db back 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 ti= mezone. I have found mentions CAAXGW-y=3D=3DFOGGB7jVWhDsaugXV20qeXUcgZSiteQ7jfMXOKi-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 function= ality? Is there a command I could run after I get the connection to say "s= et timezone =3D 'server default'"? Thanks George Woodring iGLASS Networks www.iglass.net --_000_141595243195613439nitorcreationscom_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Would an acceptable workaround for you to change the Java defa= ult timezone.

Either start the JVM with -Duser.timezone=3DGMT

or to invoke in your startup code TimeZone.setDefault(TimeZone.get("= ;GMT"));


-Mikko


From: pgsql-jdbc-owner@pos= tgresql.org <pgsql-jdbc-owner@postgresql.org> on behalf of Dave Crame= r <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 recal= l 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 y= ou get a connection ?



Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca=

On 13 November 2014 08:31, George Woodring <george.= woodring@iglass.net> wrote:
It is not the where case that is my issue.  It is tha= t the jdbc driver is changing my timezone from what I set with alter databa= se to the timezone of my web server for any queries from the web server.&nb= sp; 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 "GM= T", when I put a log into my java code and show timezone I get "U= S/Eastern".  This is causing my data not to line up correctly aro= und 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

On Wed, Nov 12, 2014 at 1:59 PM, Dave Cramer <pg@fastcrypt.com<= /a>> wrote:
George,

I looked at the stackoverflow example. I fail to see how the driver wo= uld change the where clause.

Can you create a self contained test case ?


On 12 November 2014 13:48, George Woodring <george.= woodring@iglass.net> wrote:
I originally asked a question about adjusting timezone per= db back


And it was suggested that I set them per db, which I have.  But n= ow 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=3D=3DFOGGB7jVWhDsaugXV20qeXUcgZSiteQ7jfMXOKi-A@mail.gmail.com 

and

http://stackoverflow.c= om/questions/18447995/postgresql-9-2-jdbc-driver-uses-client-time-zone<= /div>

My question here is is there a way to disable it and get the older fun= ctionality?  Is there a command I could run after I get the connection= to say "set timezone =3D 'server default'"?

Thanks
George Woodring
iGLASS Networks
www.iglass.net



--_000_141595243195613439nitorcreationscom_--