Thread: PG 7.3.2 JDBC timestamp problems between JDK 1.3.1 and 1.4.1

PG 7.3.2 JDBC timestamp problems between JDK 1.3.1 and 1.4.1

From
"David"
Date:
I'm using the same JDBC driver (build 109 for JDK 1.3 under PG 7.3.2) and I
get two different results when querying a TIMESTAMP field.

From psql, here is what we have for that particular column in my table:

           Column            |           Type           | Modifiers
-----------------------------+--------------------------+-----------
 sent_timestamp              | timestamp with time zone | not null

...and here is what it reports when I run the query:

       sent_timestamp
----------------------------
 2003-04-23 10:45:57.688-07


When running my code under JDK 1.3.1_07 on Linux using that JDBC driver, I
get the following values for my program:
As a string: Apr 23, 2003 10:45:57 AM
As a long: 1051119957688

That would appear to be correct, and mirrors the values shown in psql's
select.

But when I run my same program under JDK 1.4.1_07, the values are slightly
different with:
As a string: Apr 23, 2003 10:45:58 AM
As a long: 1051119958376

This appears to be incorrect and doesn't match psql's select value (note
that this doesn't even get the seconds correct as it's different by 688
milliseconds).  I generally don't care about the millisecond accuracy
(though I ought to be able to!), but in this case, it results in a different
value as of the seconds, and that's a big problem for me since the timestamp
seconds is used in a digital signature which won't compute with different
values.

Is there any idea on why the same driver would give different values
depending on whether it was run under JDK 1.3 versus 1.4?

Thanks,
David