Re: FW: PreparedStatement#setString on non-string parameters

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Silvio Bierman <sbierman(at)jambo-software(dot)com>
Cc: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: FW: PreparedStatement#setString on non-string parameters
Date: 2005-03-08 21:47:34
Message-ID: 422E1D76.6080307@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Silvio Bierman wrote:

> Either the JDBC drivers for the databases I mentioned earlier do the
> conversion or the database backends do it on the server side. Any way, this
> works in all cases. PostgreSQL is the first database to break our
> application due to this behaviour. We have had problems on earlier versions
> of MySQL because of lack of subselect support etc. but never these issues.

I'd suggest using CAST in your SQL -- that in theory should work
everywhere and reflects your application's intent (to interpret a string
as a numeric value).

The problem with reverting to the old way of doing parameters (direct
text substitution into the query) is that we cannot take advantage of
most of the new stuff in the V3 protocol -- that means no server-side
prepared statement reuse, no low-overhead transfer of large parameters,
and reduced support for cursor-based resultsets.

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lennie De Villiers 2005-03-08 21:51:21 PostGreSQL Date Query?
Previous Message Silvio Bierman 2005-03-08 21:23:41 FW: PreparedStatement#setString on non-string parameters