Re: Passing arrays - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Passing arrays
Date
Msg-id Pine.BSO.4.64.0807241406130.32635@leary.csoft.net
Whole thread Raw
In response to Passing arrays  ("Konrad Machlowski" <travikkman@gmail.com>)
List pgsql-jdbc

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


pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: numeric type
Next
From: Kris Jurka
Date:
Subject: Re: Timestamp Problems