pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Konrad Machlowski <travikkman@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Passing arrays
Date: Tue, 29 Jul 2008 00:10:38 -0400 (EDT)
Message-ID: <Pine.BSO.4.64.0807241406130.32635@leary.csoft.net> (raw)
In-Reply-To: <db9947150807241027u4e24455eg4a9d7157763dddca@mail.gmail.com>
References: <db9947150807241027u4e24455eg4a9d7157763dddca@mail.gmail.com>



On Thu, 24 Jul 2008, Konrad Machlowski wrote:

> I've been looking for a way to pass from Java an array value (
> Object[]/Integer[]/String[]/... ) to postgresql int2[]/varchar[] stored
> function.

You need to call setArray on a PreparedStatement or CallableStatement. 
This takes java.sql.Array instead of Integer[].  You can create a 
java.sql.Array easily if you're using a recent JDBC4 driver via 
Connection.createArrayOf.  If it's an older driver than you must create
a class that implementes java.sql.Array yourself.

Kris Jurka




view thread (2+ messages)

Message-ID: <Pine.BSO.4.64.0807241406130.32635@leary.csoft.net>
Permalink:  ../Pine.BSO.4.64.0807241406130.32635@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0807241406130.32635@leary.csoft.net

 · 

reply

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: books@ejurka.com, travikkman@gmail.com
  Subject: Re: Passing arrays
  In-Reply-To: <Pine.BSO.4.64.0807241406130.32635@leary.csoft.net>
  References: <db9947150807241027u4e24455eg4a9d7157763dddca@mail.gmail.com> <Pine.BSO.4.64.0807241406130.32635@leary.csoft.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