Re: JDBC Driver and timezones

From: "Marc Mamin" <M(dot)Mamin(at)intershop(dot)de>
To: "Thomas Kellerer" <spam_eater(at)gmx(dot)net>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC Driver and timezones
Date: 2010-05-19 07:18:42
Message-ID: C4DAC901169B624F933534A26ED7DF31034BB629@JENMAIL01.ad.intershop.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I guess the issue is a logical one.
java Time has basically no date associated and rs.getTime(n) hence does not expect a timezone information as with PG current_time.
Maybe there is a hidden fallback to rs.getTime(n, Calendar) ?

HTH,

Marc Mamin

java Time:
A thin wrapper around the java.util.Date class that allows the JDBC API to identify this as an SQL TIME value.
The Time class adds formatting and parsing operations to support the JDBC escape syntax for time values.

!! The date components should be set to the "zero epoch" value of January 1, 1970 and should not be accessed.

-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org [mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Thomas Kellerer
Sent: Mittwoch, 19. Mai 2010 08:44
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] JDBC Driver and timezones

Thomas Kellerer, 19.05.2010 08:17:
>>> 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.
>>
>> The JVM has its own separate timezone database. It does not use the
>> OS-provided timezone data in general.
>>
>
> Yes that's what I assume as well. But I'm still surprised the JVM
> doesn't apply the DST settings correctly (the timezone *is* correct)
>

Hmm, I just tested this and apparently my assumption is wrong (Java *is* using the correct DST setting)

When I run:

System.out.println("DST active: " + TimeZone.getDefault().useDaylightTime());
System.out.println("DST delta: " + TimeZone.getDefault().getDSTSavings());

it correctly shows me that the JDK knows that DST is active and that it should add one hour
(without setting a timezone when starting the JVM)

So either that information is not used by the JDK, or there is something going on in the driver.

Thomas

--
Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2010-05-19 07:27:51 Re: JDBC Driver and timezones
Previous Message Thomas Kellerer 2010-05-19 06:43:40 Re: JDBC Driver and timezones