Bad Timestamp Format Error - Mailing list pgsql-jdbc

From Paul Stead
Subject Bad Timestamp Format Error
Date
Msg-id BNENLMOEFCOIEGKDJMLLKEHHCBAA.pstead@elementallogic.com
Whole thread Raw
Responses Re: Bad Timestamp Format Error
List 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


pgsql-jdbc by date:

Previous
From: Aaron Mulder
Date:
Subject: Re: help with DBvisualiser install for postgresql jdbc
Next
From: bvol
Date:
Subject: dbvisualizer and jdbc driver in postgres7.2