pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jean-Pierre Pelletier <pelletier_32@sympatico.ca>
To: pgsql-jdbc@postgresql.org
Cc: Jean-Pierre Pelletier <jppelletier@e-djuster.com>
Subject: setObject on PGInterval throws "Unknown Type null"
Date: Mon, 24 Jan 2005 13:30:40 -0500
Message-ID: <BAYC1-PASMTP01298C210325B348452D7995850@cez.ice> (raw)

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

view thread (15+ messages)  latest in thread

Message-ID: <BAYC1-PASMTP01298C210325B348452D7995850@cez.ice>
Permalink:  ../BAYC1-PASMTP01298C210325B348452D7995850@cez.ice/
Also on:    postgresql.org/message-id/BAYC1-PASMTP01298C210325B348452D7995850@cez.ice

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pelletier_32@sympatico.ca, jppelletier@e-djuster.com
  Subject: Re: setObject on PGInterval throws "Unknown Type null"
  In-Reply-To: <BAYC1-PASMTP01298C210325B348452D7995850@cez.ice>
  References: <BAYC1-PASMTP01298C210325B348452D7995850@cez.ice>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox