Re: setObject(...) with native Java arrays like String[] ? - Mailing list pgsql-jdbc

From dmp
Subject Re: setObject(...) with native Java arrays like String[] ?
Date
Msg-id 5034F837.7060103@ttc-cmc.net
Whole thread Raw
In response to Re: setObject(...) with native Java arrays like String[] ?  (John Lister <john.lister@kickstone.com>)
Responses Re: setObject(...) with native Java arrays like String[] ?  (Craig Ringer <ringerc@ringerc.id.au>)
List pgsql-jdbc
> On 22/08/2012 04:09, Craig Ringer wrote:
>>
>> I was recently surprised to find that PgJDBC doesn't accept Java
>> arrays as parameters to prepared statements.

I'm not surprised at this behavior since I needed to support all data
types with the MyJSQLView application for PostgreSQL. The app uses
prepare statements for inserts/updates and I found out very early
that all data types needed to be explicitly stated for prepare statements.
This is not the JDBC from my understanding, but rather the PostgreSQL
server. You can get away with this in other databases, but not so for
PostgreSQL.

One way around this I found is send the data with the initial prepare
statement creation. This of course precludes recursive use then of the
statement. Kinda defeats the purpose, but for singluar inserts/update
works fine.

It looks like from your code the arrays you speak of are not java.sql.Array?


 > John Lister wrote:
> As was I, I posted a patch a couple of months ago that did the same
> thing but also accepted java List types as well (I'm often using these
> especially with JPA and it would be nice to pass them into the driver),
> although it seems to have been silently ignored. Maybe I'll repost it.

John, the Silence I think is not purposeful. With the port to GIT does
this not allow contributors to more easily process patches independently?
I'm not that familiar with GIT so I apologize up front for my ignorance.

danap.


pgsql-jdbc by date:

Previous
From: John Lister
Date:
Subject: Re: setObject(...) with native Java arrays like String[] ?
Next
From: Craig Ringer
Date:
Subject: Re: setObject(...) with native Java arrays like String[] ?