Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group