Bad Timestamp Format Error

From: "Paul Stead" <pstead(at)elementallogic(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Bad Timestamp Format Error
Date: 2002-07-31 19:04:33
Message-ID: BNENLMOEFCOIEGKDJMLLKEHHCBAA.pstead@elementallogic.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi all,

I'm writing a Java program that uses JDBC to extract data from existing
databases, one of which is PostgreSQL. When it tries to read a timestamp
created using NOW() from the postgreSQL database, it throws an exception.
If I enter the time manually such that there are no nanoseconds it works
fine.

So if I set datebegin using NOW(), it looks something like:
2002-07-31 09:18:01.414573-07
and when I use this Java statement:
campaign.setStart( sqlResults.getTimestamp(4).getTime() );
where campaign.setStart looks like:
public void setStart(long useDate)
{
begin = new Date(useDate);
}
I get the exception:
Bad Timestamp Format at 23 in 2002-07-31 09:18:01.414573-07

However, if I set datebegin as:
2002-07-31 09:18:01-07
it works fine....

Any ideas on how to get around this??? The database used NOW() for
timestamps throughout, so nanoseconds are everywhere.

thanks in advance,
Paul

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message bvol 2002-07-31 21:37:08 dbvisualizer and jdbc driver in postgres7.2
Previous Message bvol 2002-07-31 17:06:55 help with DBvisualiser install for postgresql jdbc