setObject on PGInterval throws "Unknown Type null"

Поиск
Список
Период
Сортировка
От Jean-Pierre Pelletier
Тема setObject on PGInterval throws "Unknown Type null"
Дата
Msg-id BAYC1-PASMTP01298C210325B348452D7995850@cez.ice
обсуждение исходный текст
Ответы Re: setObject on PGInterval throws "Unknown Type null"
Список 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Versioned vs unversioned jarfile names?
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: PGResultSetMetaData