Re: JDBC Driver and timezones

Поиск
Список
Период
Сортировка
От Marc Mamin
Тема Re: JDBC Driver and timezones
Дата
Msg-id C4DAC901169B624F933534A26ED7DF31034BB629@JENMAIL01.ad.intershop.net
обсуждение исходный текст
Ответ на Re: JDBC Driver and timezones  (Thomas Kellerer <spam_eater@gmx.net>)
Список 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@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Thomas Kellerer
Sent: Mittwoch, 19. Mai 2010 08:44
To: pgsql-jdbc@postgresql.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: JDBC Driver and timezones
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: JDBC Driver and timezones