Re: Bug: Cannot pass null in Parameter in Query for ISNULL - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Bug: Cannot pass null in Parameter in Query for ISNULL
Date
Msg-id CA+0W9LM4xcS0r=X_TwUA4kJKpat+1WitY01eB8WD6Rgzj=i0mg@mail.gmail.com
Whole thread Raw
In response to Re: Bug: Cannot pass null in Parameter in Query for ISNULL  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: Bug: Cannot pass null in Parameter in Query for ISNULL
List pgsql-jdbc
On 30 November 2011 20:01, Oliver Jowett <oliver@opencloud.com> wrote:

> This is specific to calling PreparedStatement.setObject(index, null).

> To avoid this, use one of these instead:
>
>  * PreparedStatement.setObject(index, null, type)
>  * PreparedStatement.set<type>(index, null)
>  * PreparedStatement.setNull(index, type)
>
> all of which provide type information that the driver needs.

I'd also refer you to the JDBC javadoc for setObject(int,Object) which says:

==
Note: Not all databases allow for a non-typed Null to be sent to the
backend. For maximum portability, the setNull or the setObject(int
parameterIndex, Object x, int sqlType) method should be used instead
of setObject(int parameterIndex, Object x).
==

Oliver

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Bug: Cannot pass null in Parameter in Query for ISNULL
Next
From: bht@actrix.gen.nz
Date:
Subject: Re: Bug: Cannot pass null in Parameter in Query for ISNULL