Re: DatabaseMetaData and Transactions

From: Kris Jurka <books(at)ejurka(dot)com>
To: Carl Olivier <carl(at)zero-one(dot)co(dot)za>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: DatabaseMetaData and Transactions
Date: 2005-06-07 16:27:14
Message-ID: Pine.BSO.4.56.0506071125270.6588@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-06-07 16:32:08 Re: Probleme with jdbc driver an openxhange.
Previous Message Gilles Dubochet 2005-06-07 16:11:16 Binary precision of a number type