From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC Driver and timezones
Date: Wed, 19 May 2010 00:01:29 +0200
Message-ID: <hsv2np$qhq$1@dough.gmane.org> (raw)
In-Reply-To: <e979a6b62190fc12d767b1aa28fb724e.squirrel@webmail.axn-software.de>
References: <hstmm1$96v$1@dough.gmane.org>
<e979a6b62190fc12d767b1aa28fb724e.squirrel@webmail.axn-software.de>
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 initial post.
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 thus the 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, but for 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/dbla...
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: JDBC Driver and timezones
In-Reply-To: <hsv2np$qhq$1@dough.gmane.org>
References: <hstmm1$96v$1@dough.gmane.org> <e979a6b62190fc12d767b1aa28fb724e.squirrel@webmail.axn-software.de> <hsv2np$qhq$1@dough.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox