pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC and Timestamps
3+ messages / 3 participants
[nested] [flat]

* JDBC and Timestamps
@ 2000-08-05 12:26  Chris Ryan <chris@greatbridge.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Chris Ryan @ 2000-08-05 12:26 UTC (permalink / raw)
  To: pgsql-interfaces

I'm working on a project where I update/insert/select records through
JDBC and I'm noticing problems with the timestamp fields. The JDBC
driver when writing a Timestamp value to postgres is passing the value
to the backend as a String in the following format "yyyy-mm-dd
hh:mm:ss.fffffffff" <-- the last part .fffffffff is nanosecs. When
Postgres reads this is things it is millisecs so converts it and appends
the timezone. Now when the JDBC driver reads the value back in it is
trying to do a date conversion from a string using the format
"yyyy-mm-dd hh:mm:sszzz" which has timezone but no millisecs. The
different formats of course cause exceptions to be generated. I tried
using the setLenient(true) but this didn't make any difference.

Chris Ryan




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* RE: JDBC and Timestamps
@ 2000-08-05 13:20  Peter Mount <petermount@it.maidstone.gov.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Mount @ 2000-08-05 13:20 UTC (permalink / raw)
  To: 'Chris Ryan' <chris@greatbridge.com>; pgsql-interfaces

This should already be fixed in cvs.

Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council


-----Original Message-----
From: Chris Ryan [mailto:chris@greatbridge.com]
Sent: Saturday, August 05, 2000 1:26 PM
To: pgsql-interfaces@postgresql.org
Subject: [INTERFACES] JDBC and Timestamps


I'm working on a project where I update/insert/select records through
JDBC and I'm noticing problems with the timestamp fields. The JDBC
driver when writing a Timestamp value to postgres is passing the value
to the backend as a String in the following format "yyyy-mm-dd
hh:mm:ss.fffffffff" <-- the last part .fffffffff is nanosecs. When
Postgres reads this is things it is millisecs so converts it and appends
the timezone. Now when the JDBC driver reads the value back in it is
trying to do a date conversion from a string using the format
"yyyy-mm-dd hh:mm:sszzz" which has timezone but no millisecs. The
different formats of course cause exceptions to be generated. I tried
using the setLenient(true) but this didn't make any difference.

Chris Ryan



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: JDBC and Timestamps
@ 2000-08-05 23:30  Thomas Lockhart <lockhart@alumni.caltech.edu>
  parent: Peter Mount <petermount@it.maidstone.gov.uk>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Lockhart @ 2000-08-05 23:30 UTC (permalink / raw)
  To: Peter Mount <petermount@it.maidstone.gov.uk>; +Cc: 'Chris Ryan' <chris@greatbridge.com>; pgsql-interfaces

> ... I'm noticing problems with the timestamp fields. The JDBC
> driver when writing a Timestamp value to postgres is passing the value
> to the backend as a String in the following format "yyyy-mm-dd
> hh:mm:ss.fffffffff" <-- the last part .fffffffff is nanosecs.

Do you actually need nanosecond (or sub-microsecond) resolution? At the
moment, Postgres rounds internal values *and* truncates printed results
to avoid accumulating internal roundoff errors. But I did that pretty
conservatively, rather than actually testing to see if it could carry
more precision.

If you want to test with more precision, we could try some variations...

                  - Thomas



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-08-05 23:30 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-05 12:26 JDBC and Timestamps Chris Ryan <chris@greatbridge.com>
2000-08-05 13:20 RE: JDBC and Timestamps Peter Mount <petermount@it.maidstone.gov.uk>
2000-08-05 23:30 ` Thomas Lockhart <lockhart@alumni.caltech.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox