Re: PreparedStatement#setString on non-string parameters

From: Guillaume Cottenceau <gc(at)mnc(dot)ch>
To: "Silvio Bierman" <sbierman(at)jambo-software(dot)com>
Cc: "PostgreSQL JDBC" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: PreparedStatement#setString on non-string parameters
Date: 2005-03-08 13:20:15
Message-ID: 87k6oil1f4.fsf@meuh.mnc.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

"Silvio Bierman" <sbierman 'at' jambo-software.com> writes:

[...]

> 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?

Where can you see that?

I can see pretty much the opposite, for example the following at
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html

-=-=---=-=---=-=---=-=---=-=--
Note: The setter methods (setShort, setString, and so on) for
setting IN parameter values must specify types that are
compatible with the defined SQL type of the input parameter. For
instance, if the IN parameter has SQL type INTEGER, then the
method setInt should be used.
-=-=---=-=---=-=---=-=---=-=--

And even, at
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html#setString(int,%20java.lang.String)

-=-=---=-=---=-=---=-=---=-=--
setString: The driver converts this to an SQL VARCHAR or
LONGVARCHAR value (depending on the argument's size relative to
the driver's limits on VARCHAR values) when it sends it to the
database.
-=-=---=-=---=-=---=-=---=-=--

--
Guillaume Cottenceau

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Prajakt Deolasee 2005-03-08 13:49:05 Postgres is slow
Previous Message Dave Cramer 2005-03-08 13:09:35 Re: PreparedStatement#setString on non-string parameters