Re: JDBC Driver and timezones - Mailing list pgsql-jdbc

From Thomas Kellerer
Subject Re: JDBC Driver and timezones
Date
Msg-id hsv2np$qhq$1@dough.gmane.org
Whole thread Raw
In response to Re: JDBC Driver and timezones  ("Carsten Klein" <carsten.klein@axn-software.de>)
Responses Re: JDBC Driver and timezones  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
Carsten Klein wrote on 18.05.2010 23:35:

> actually, your application server is not using the system's default
> timezone, see the configuration of your server.

The timezone is correct. The DST information seems to be "broken".

Besides: I'm not using an application server. It's a Swing application that retrieves the data via JDBC

The output from my initial post was from a very simply main() class, only runs that single statement I posted in my
initialpost. 
Even then it only works when I manually set user.timezone=GMT+2

And for the test case the client application _and_ Postgres were running on the same physical machine. So the JVM (and
thusthe JDBC driver) and Postgres should use the same timezone information from my Windows. 

When I output the value of user.timezone (when not setting it manually) it does report the correct one: Europe/Berlin,
butfor some reason it does not apply the DST settings correctly. 

> In order to overcome this problem, I have adjusted a db layer that we are
> using in the OSS VerA.Web project so that it will use proxies for the most
> relevant objects (resultset and so on) that then will just drop the
> timezone information in the data received from the database, so that when
> instantiating the datetime object in the application server, it will
> automatically take over the configured timezone. That way, you will
> experience no timeshift, whatsoever.
>
> See
>
https://evolvis.org/scm/viewvc.php/tags/tarent-database-1.5.4verawebpl3/src/main/java/de/tarent/dblayer/engine/proxy/?root=tarentdatabase

Thanks for the link, but as I said: this is a Swing application that directly connects to the Postgres server.
But I'm curious: why didn't you simply change the timezone for the JVM running your appserver?

Regards
Thomas

pgsql-jdbc by date:

Previous
From: "Carsten Klein"
Date:
Subject: Re: JDBC Driver and timezones
Next
From: Matt Solnit
Date:
Subject: Change the socket timeout of a live connection?