From: dmp <danap@ttc-cmc.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: setObject(...) with native Java arrays like String[] ?
Date: Wed, 22 Aug 2012 09:18:15 -0600
Message-ID: <5034F837.7060103@ttc-cmc.net> (raw)
In-Reply-To: <50347EBC.2090505@kickstone.com>
References: <50344D58.9010401@ringerc.id.au>
<50347EBC.2090505@kickstone.com>
> 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.
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: danap@ttc-cmc.net
Subject: Re: setObject(...) with native Java arrays like String[] ?
In-Reply-To: <5034F837.7060103@ttc-cmc.net>
References: <50344D58.9010401@ringerc.id.au> <50347EBC.2090505@kickstone.com> <5034F837.7060103@ttc-cmc.net>
* 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