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