Exception retrieving timestamp without timezone value

From: Stephen Bacon <sbacon(at)13x(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Exception retrieving timestamp without timezone value
Date: 2002-08-15 19:36:35
Message-ID: 1029440195.9581.32.camel@babylon.13x.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,
I've noticed an exception when dealing with a TIMESTAMP WITHOUT
TIMEZONE column.

my code (in an attempt to track it down) is:

debugMessage("06");
debugMessage(rsIRFPAIRec.getString("CreatedOn"));
java.sql.Timestamp tsloadtemp = rsIRFPAIRec.getTimestamp("CreatedOn");
debugMessage(tsloadtemp.toString());
long lloadtemp = tsloadtemp.getTime();
debugMessage(Long.toString(lloadtemp));
java.util.Date dtloadtemp = new java.util.Date(lloadtemp);
debugMessage(dtloadtemp.toString());

the output in my debug file is:

*** Aug 15, 2002 2:34:49 PM 2001-12-03 14:28:53.77
*** Aug 15, 2002 2:34:49 PM Exception loading from tblIRFPAI_Main:
String index out of range: 22

So it seems that either the ResultSet.getTimestamp() is causing it, or
the Timestamp.toString() is.

Either way this seems to be a prob in the driver? I searched the archive
for this error, but only found it mentioned as fixed in regards to the
regular TIMESTAMP (i.e. with time zone)

Or maybe the pgjdbc2.jar file at
http://jdbc.postgresql.org/download.html is out of date?

further details:
version
-------------------------------------------------------------
PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96

"java -version" returns:
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

thanks,
-Steve

p.s. this of course begs the question "why is he using WITHOUT TIMEZONE"
and the answer: no good reason! I've switched back to TIMESTAMP WITH
TIMEZONE and the problem disappears.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-08-15 21:01:57 Re: Exception retrieving timestamp without timezone value
Previous Message Zengfa Gao 2002-08-15 18:21:07 Update ResultSet for JDBC