Re: Date problem on Aix jdk1.4.1 - Mailing list pgsql-jdbc

From Byron Nikolaidis
Subject Re: Date problem on Aix jdk1.4.1
Date
Msg-id 6E0907A94904D94B99D7F387E08C4F570732F0@FALCON.INSIGHT
Whole thread Raw
In response to Date problem on Aix jdk1.4.1  ("Byron Nikolaidis" <ByronN@Routescape.com>)
Responses Re: Date problem on Aix jdk1.4.1
List pgsql-jdbc
Here is a really simple test:

public class DateTest {

    public static void main(String[] args) throws Exception {
        Class.forName("org.postgresql.Driver");
        Connection connection =
DriverManager.getConnection("jdbc:postgresql://host/db");
        Statement statement = connection.createStatement();
        ResultSet rs = statement.executeQuery("select id, effective from
date_test");
        while(rs.next() ) {
            Date effective = rs.getDate("effective");
            int id = rs.getInt("id");
            System.out.println("id="+id+", effective="    +
effective.getTime());
        }
        connection.close();
    }
}

Schema Stuff:

CREATE TABLE date_test
(
  effective date,
  id int2
)

INSERT INTO date_test VALUES ('2005-07-26', 1);
INSERT INTO date_test VALUES ('2005-07-26', 2);
INSERT INTO date_test VALUES ('2005-07-26', 3);


The output results:

/usr/java14/bin/java -cp "/usr/insight/postgresql.jar:." DateTest

id=1, effective=1122350400000    <---  correct
id=2, effective=1122354000000    <---   +1 hour
id=3, effective=1122354000000    <---   all same from here out



-----Original Message-----
From: Oliver Jowett [mailto:oliver@opencloud.com]
Sent: Wednesday, July 27, 2005 6:59 PM
To: Byron Nikolaidis
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Date problem on Aix jdk1.4.1

Byron Nikolaidis wrote:

> When I query any table with a regular old Date in it,  the first row
> that comes back is correct (some Date value with 00:00:00 as the time)
,
> however all subsequent rows are advanced by 1 hour (they have a time
of
> 01:00:00) .    This happens on any table.

It's quite weird that it's different on the first row, otherwise I'd say
it was a local JVM timezone issue.

Do you have some test code we can try? Without knowing what the
underlying column's type is or which ResultSet accessor you're using
it's just guesswork.

-O

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: jdbc xa patches
Next
From: Oliver Jowett
Date:
Subject: Re: Date problem on Aix jdk1.4.1