Exception retrieving timestamp without timezone value - Mailing list pgsql-jdbc

From Stephen Bacon
Subject Exception retrieving timestamp without timezone value
Date
Msg-id 1029440195.9581.32.camel@babylon.13x.com
Whole thread Raw
List 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.



pgsql-jdbc by date:

Previous
From: Jun KAWAI
Date:
Subject: Re: md5 authentication bug?
Next
From: Barry Lind
Date:
Subject: Re: Exception retrieving timestamp without timezone value