Re: Bad Timestamp Format Error

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


BOY DO I FEEL DUMB!!

Sorry everyone....
I had the jdbc7.1-1.2.jar on my dev machine,
and the production machine had
pgjdbc2.jar running a 7.2.1 PostgreSQL database.....

When I updated my dev machine's jar to pgjdbc2.jar (actually I got
devpgjdbc2.jar) everything was fine....

Just shows to go ya!!! Know what versions of EVERYTHING you are running
EVERYWHERE!!

(red-faced)
Paul

-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Paul Stead
Sent: Wednesday, July 31, 2002 12:05 PM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] Bad Timestamp Format Error

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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sanjeev Kumar 2002-08-01 00:22:32
Previous Message Paul Stead 2002-07-31 23:31:26 Re: Bad Timestamp Format Error