Re: DatabaseMetaData and Transactions - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: DatabaseMetaData and Transactions
Date
Msg-id 42A613DA.7090300@opencloud.com
Whole thread Raw
In response to Re: DatabaseMetaData and Transactions  (Carl Olivier <carl@zero-one.co.za>)
Responses Re: DatabaseMetaData and Transactions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc
Carl Olivier wrote:

> 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.

> ERROR: column "created_by" is of type integer but expression is of type
> character varying

> 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?

You're going to have to pass metadata down, or change your queries to
explicitly cast the parameters in the SQL itself. The driver has exactly
the same problem as your code does -- with the v3 protocol it needs to
provide a type for the parameter, but if it's just provided as a string
the only type it can assume is text..

-O

pgsql-jdbc by date:

Previous
From: Sathyajith G
Date:
Subject: Re: exception while upgrading driver
Next
From: Oliver Jowett
Date:
Subject: Re: 8.x driver with EJB CMP