Re: PreparedStatement#setString on non-string parameters - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: PreparedStatement#setString on non-string parameters
Date
Msg-id 422E17D5.9080109@opencloud.com
Whole thread Raw
In response to PreparedStatement#setString on non-string parameters  ("Silvio Bierman" <sbierman@jambo-software.com>)
List pgsql-jdbc
Silvio Bierman wrote:

> The JDBC spec requires the driver to attempt a conversion when a
> setString is done on a non-string parameter. This will break a lot of
> conformant code, not only ours. Is there any chance this can be corrected?

AFAIK, the spec doesn't require this. Can you point me at the bit of the
spec that makes you think it does?

As I read the spec, the only conversions the driver performs for IN
parameters are those in table B-2 (for String, to
CHAR/VARCHAR/LONGVARCHAR) or B-4 (same mapping for String). See 13.2.2.1
and 13.2.2.2 of the JDBC 3.0 spec.

There is a wider set of conversions available on the ResultSet path
(notably, integer -> string) -- see 14.2.3.1 and table B-6.

-O

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgres is slow
Next
From: "Silvio Bierman"
Date:
Subject: FW: PreparedStatement#setString on non-string parameters