From: Byron Nikolaidis <ByronN@Routescape.com>
To: pgsql-jdbc@postgresql.org
Subject: prepared statement incompatibility
Date: Tue, 28 Jun 2005 16:25:25 -0400
Message-ID: <6E0907A94904D94B99D7F387E08C4F57073220@FALCON.INSIGHT> (raw)
Hello all,
We are using Postgres 8.0.3, and are attempting to upgrade to the JDBC
8.x drivers, but have discovered that PreparedStatements that used to
work no longer do so. This is seen where the Java type does not match
the database type, such as attempting to use
preparedStatement.setString(1, "1") where the database type is
actually an integer (see stacktrace below). These worked fine on
previous driver versions (such as 7.4).
If we set the protocolVersion=2, the jdbc 8.x drivers will work fine
also, but I'm not so sure we really want to do that.
At first, I thought this was related to the use of server side prepares.
But I have set the prepareThreshold=0 and verified it was being set by
checking for it in the pgconnection and pgstatement, but it appears to
have no effect.
Can anyone clarify what exactly has changed with prepared statements and
why it used to work previously?
Thanks,
Byron
Exception in thread "main" java.sql.SQLException: ERROR: column "ticket"
is of type integer but expression is of type character varying
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecu
torImpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImp
l.java:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:
175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stateme
nt.java:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdb
c2Statement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2S
tatement.java:282)
at test.routescape.orm.util.DriverTest.main(DriverTest.java:49)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: ByronN@Routescape.com
Subject: Re: prepared statement incompatibility
In-Reply-To: <6E0907A94904D94B99D7F387E08C4F57073220@FALCON.INSIGHT>
References: <6E0907A94904D94B99D7F387E08C4F57073220@FALCON.INSIGHT>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox