setObject on PGInterval throws "Unknown Type null"

From: "Jean-Pierre Pelletier" <pelletier_32(at)sympatico(dot)ca>
To: <pgsql-jdbc(at)postgresql(dot)org>
Cc: "Jean-Pierre Pelletier" <jppelletier(at)e-djuster(dot)com>
Subject: setObject on PGInterval throws "Unknown Type null"
Date: 2005-01-24 18:30:40
Message-ID: BAYC1-PASMTP01298C210325B348452D7995850@cez.ice
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

We upgraded to JDBC Build 309 on PostgreSQL 8.0 from
JDBC Build 307 on PostgreSQL 7.4 and setObject now fails
on PGInterval

1)
if myPgInterval != null
Originally code: myPreparedStatement.setObject(i, myPGInterval)
It throws SQLException "Unknown type null"

We tried: myPreparedStatement.setObject(i, myPGInterval, Types.OTHER)
It throws "Unknown type null"

if myPgInterval == null
Original code: myPreparedStatement.setObject(i,myPGInterval)
It throws "setObject(i,null) is not supported. Instead, use setNull(i,type) or setObject(i,null,type)"

We tried: myPreparedStatement.setNull(i, Types.OTHER)
It throws "setNull(i, Types.OTHER) is not supported; use setObject(i,null, Types.OTHER) instead"

We tried: myPreparedStatement.setObject(i,myPGInterval,Types.OTHER)
It throws "setNull(i, Types.OTHER) is not supported; use setObject(i,null, Types.OTHER) instead"

How should setObject be coded with a PGInterval ?

2)
With JDBC Build 309, setObject requires an SQL Type when object == null,
this makes setObject(i, object) useless.

Why do JDBC requires an SQL Type when the same statement can be processed by psql
without the SQL type specified?

Why is a standard JDBC method setObject(i, object) rendered useless?
Is it supported by other DBMS?

Thanks
Jean-Pierre Pelletier

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-01-24 19:35:54 Re: PGResultSetMetaData
Previous Message Dave Cramer 2005-01-24 17:53:07 Re: Versioned vs unversioned jarfile names?