Re: setObject(i,null) and general "setNull" problems - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: setObject(i,null) and general "setNull" problems
Date
Msg-id 421A7AA7.9040303@opencloud.com
Whole thread Raw
In response to setObject(i,null) and general "setNull" problems  (Valentin Rodionov <valiar@scripps.edu>)
List pgsql-jdbc
Valentin Rodionov wrote:

[...]

Most of this is irrelevant because the driver has already changed back
to the old behaviour, as Kris has pointed out, but..

> Is there any possibility to make this "NULL typing" thing optional? I
> would bet most users of the JDBC driver
> don't care for typing their null values!
> Even if this behavior is a part of the JDBC standard (is it?)

The JDBC standard is set up so that drivers have type information for
all parameters available, even if NULL. For example, see the javadoc for
setNull. The users may not care, but there are cases where the driver or
db can't sensibly/safely infer that type information when it needs to..

It's not clear if setObject(i,null) should be used by a spec-compliant
application or not. It seems like an oversight that this isn't
forbidden, as there's no other way to get an untyped NULL into the
driver. I have asked the JDBC expert group to clarify this but haven't
had a response yet.

There are good robustness reasons for typing all your parameters, even
if NULL, but it seems that noone cares about that :(

-O

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: setObject(i,null) and general "setNull" problems
Next
From: Valentin Rodionov
Date:
Subject: Re: setObject(i,null) and general "setNull" problems