From: | Mark Lewis <mark(dot)lewis(at)mir3(dot)com> |
---|---|
To: | Carl Olivier <carl(at)zero-one(dot)co(dot)za> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: DatabaseMetaData and Transactions |
Date: | 2005-06-07 18:16:33 |
Message-ID: | 1118168193.24149.7.camel@archimedes.mirlogic.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
You can work around this problem by disabling the V3 protocol, which is
by default used when communicating with newer servers. This is a
performance hit because the V3 protocol is faster than V2, but shouldn't
be too bad.
See docs here:
http://jdbc.postgresql.org/documentation/head/connect.html#connection-
parameters
-- Mark Lewis
On Tue, 2005-06-07 at 12:54 +0200, Carl Olivier wrote:
...
> In 7.3 (using the 7.3 JDBC driver) we were able to do the following:
>
> === SNIP ===
>
> if (value == null)
> {
> stmt.setString( index, null );
> }
>
> === END ===
>
> Some context here. We have a method that constructs a PreparedStatement
> taking the sql (eg):
>
> UPDATE table SET cola = ?, colb = ?, colc = ?
>
> Or
>
> INSERT INTO table (cola, colb, colc) VALUES (?, ?, ?)
>
> And an Object[] of values (in the correct order) for the sql being used in
> the PreparedStatement.
>
> Now - the reason we do a setString(index, null) and not a setNull(index,
> Types.SOME_TYPE) is because this method is generic and does not always KNOW
> the datatypes for the columns.
>
> Now, using PostgreSQL 8 (and the new JDBC driver for 8) we ARE still able to
> do that when using a 7..3 db server, but get the following error when using
> a version 8 PGSQL server:
>
> ERROR: column "created_by" is of type integer but expression is of type
> character varying
>
> Where created_by is being passed a NULL value (using the setString(index,
> null) method).
>
> Does anyone have any comments/suggestions/etc? Is there any way to get
> around this? Or will we need to update our side to always pass in the
> column meta data etc for use?
>
...
From | Date | Subject | |
---|---|---|---|
Next Message | Sunil.Vishnubhotla | 2005-06-07 18:37:05 | 8.x driver with EJB CMP |
Previous Message | Kris Jurka | 2005-06-07 16:32:08 | Re: Probleme with jdbc driver an openxhange. |