Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 99A55632752 for ; Tue, 18 May 2010 06:30:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 79964-09 for ; Tue, 18 May 2010 09:29:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 551B06321BA for ; Tue, 18 May 2010 06:29:49 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OEJ7T-0005Ca-3I for pgsql-jdbc@postgresql.org; Tue, 18 May 2010 11:29:47 +0200 Received: from 217.110.94.67 ([217.110.94.67]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 May 2010 11:29:47 +0200 Received: from spam_eater by 217.110.94.67 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 May 2010 11:29:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org connect(): No such file or directory From: Thomas Kellerer Subject: JDBC Driver and timezones Date: Tue, 18 May 2010 11:29:37 +0200 Lines: 46 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.67 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.746 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_NUMERIC_HELO=1.164, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/42 X-Sequence-Number: 20526 Hi, I have a little problem regarding timezones in the JDBC driver. I have a locally installed Postgres server (PG 8.4.3 on Windows XP), so there is no difference between the timezone of the server and the client application. When I run the following in psql: select current_time, localtime; I get the following output: timetz | time -----------------+-------------- 11:15:30.464+02 | 11:15:30.464 (1 row) which is fine. Now when I run the same statement through JDBC : Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select current_time, localtime"); if (rs.next()) { System.out.println("current_time: " + rs.getTime(1).toString()); System.out.println("localtime: " + rs.getTime(2).toString()); } I get the following output: current_time: 10:18:49 localtime: 11:18:49 My expectation would have been to get the same display, but the current_time is one our off, which seems to be a problem with the daylight savings time.I The timezone for my computer is setup correctly (the clock is showing the correct time, and apparently psql has the correct time as well) The display from Java only works if I explicitely set the timezone when starting the JVM using -Duser.timezone=GMT+2 Is this a Java/JDK problem, a Windows problem or a driver problem? I'm using JDK 1.6.0_18 Regards Thomas