Re: Exception retrieving timestamp without timezone value

From: Barry Lind <barry(at)xythos(dot)com>
To: Stephen Bacon <sbacon(at)13x(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Exception retrieving timestamp without timezone value
Date: 2002-08-15 21:01:57
Message-ID: 3D5C16C5.20108@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Stephen,

This is fixed in current sources. If you try the development build of
the driver off of the web site you should see this problem solved.

--Barry

Stephen Bacon wrote:

>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.
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org
>
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message hhaag 2002-08-16 08:01:04 Re: Inserting large BLOBs via JDBC - OutOfMemoryError
Previous Message Stephen Bacon 2002-08-15 19:36:35 Exception retrieving timestamp without timezone value