Re: error: ResultSet.updateObject(timestamp in POSTGRES, - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: error: ResultSet.updateObject(timestamp in POSTGRES,
Date
Msg-id Pine.BSO.4.63.0608292135190.28706@leary2.csoft.net
Whole thread Raw
In response to error: ResultSet.updateObject(timestamp in POSTGRES, DATE(7) in ORACLE )  ("Vidas Makauskas" <vms@centras.lt>)
List pgsql-jdbc

On Mon, 28 Aug 2006, Vidas Makauskas wrote:

> I've upgrade SLES9 with pg73b1jdbc3.jar to SLES10 with
> postgresql-8.1-404.jdbc3.jar
>
> ResultSet.updateObject(timestamp in POSTGRES, DATE(7) from ORACLE database
> via OJDBC13.JAR )
> begin produce error in ResultSet.insertRow():
> Exception in thread "main" java.lang.ClassCastException
>        at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateRowBuffer(AbstractJdbc2ResultSet.java:1727)
>        at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.insertRow(AbstractJdbc2ResultSet.java:832)
> .........
>

I can reproduce this using only postgresql by trying to copy a date field
to a timestamp field.  The issue is that the updatable result set code
assumes that if the target is a timestamp then the incoming object will
also be a timestamp and it may safely cast that object to a
java.sql.Timestamp.  This is not always so as shown, so the driver needs
some more powerful conversion utilities here, something along the lines of
PreparedStatement.setObject(index, obj, targetType) would do the trick.
This is a low priority item for me, so I won't be working on this anytime
soon, but here's the test case I used.

Kris Jurka

Attachment

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: outOfMemoryError
Next
From: Kris Jurka
Date:
Subject: Re: Could not determine data type of parameter $1