Re: DatabaseMetaData and Transactions - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: DatabaseMetaData and Transactions
Date
Msg-id Pine.BSO.4.56.0506071125270.6588@leary.csoft.net
Whole thread Raw
In response to Re: DatabaseMetaData and Transactions  (Carl Olivier <carl@zero-one.co.za>)
List pgsql-jdbc

On Tue, 7 Jun 2005, Carl Olivier wrote:

> In 7.3 (using the 7.3 JDBC driver) we were able to do the following:
>
> === SNIP ===
>
> if (value == null)
> {
>     stmt.setString( index, null );
> }
>
> Now, using PostgreSQL 8 (and the new JDBC driver for 8) we ARE still able to
> do that when using a 7..3 db server, but get the following error when using
> a version 8 PGSQL server:
>
> ERROR: column "created_by" is of type integer but expression is of type
> character varying
>
> Where created_by is being passed a NULL value (using the setString(index,
> null) method).
>

If you don't know what the type is you shouldn't use setString, instead
try setObject(index, null) or setNull(index, Types.OTHER) which should
work as you desire.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Carl Olivier
Date:
Subject: Re: DatabaseMetaData and Transactions
Next
From: Kris Jurka
Date:
Subject: Re: Probleme with jdbc driver an openxhange.