From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Byron Nikolaidis <ByronN(at)routescape(dot)com> |
Cc: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: prepared statement incompatibility |
Date: | 2005-06-28 20:43:30 |
Message-ID: | 9542C79E-EF74-4336-86F6-85D2B140FD6C@fastcrypt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
The new driver is more strict about the use of setXXX. Your only
option is to use protocol version 2 if you do not want to specify the
correct underlying type.
You can use setObject(colnumber, String, type )
Dave
On 28-Jun-05, at 4:25 PM, Byron Nikolaidis wrote:
> 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
> (QueryExecutorImpl.java:1471)
>
> at org.postgresql.core.v3.QueryExecutorImpl.processResults
> (QueryExecutorImpl.java:1256)
>
> at org.postgresql.core.v3.QueryExecutorImpl.execute
> (QueryExecutorImpl.java:175)
>
> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
> (AbstractJdbc2Statement.java:389)
>
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
> (AbstractJdbc2Statement.java:330)
>
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate
> (AbstractJdbc2Statement.java:282)
>
> at test.routescape.orm.util.DriverTest.main(DriverTest.java:
> 49)
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Byron Nikolaidis | 2005-06-28 21:44:37 | Re: prepared statement incompatibility |
Previous Message | Mark Lewis | 2005-06-28 20:29:42 | Re: OT: easiest way to create a custom PreparedStatement |