Re: passing array as parameters to PrepareStatement or callable

From: Kris Jurka <books(at)ejurka(dot)com>
To: Assad Jarrahian <jarraa(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: passing array as parameters to PrepareStatement or callable
Date: 2005-11-13 08:50:56
Message-ID: Pine.BSO.4.61.0511130347040.6118@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sat, 12 Nov 2005, Assad Jarrahian wrote:

> Hello all,
> my apologies if this question has been asked before. I looked
> through the archives could not find the relevant info (if I overlooked
> something, sorry).
>
> int[] intarray = new int[1];
> getAssociatedLMs.setObject(1, intarray, java.sql.Types.ARRAY);
> //getAssociatedLM's is a callable statement ("{call getLMs(?,?) } ");
>
> so I get a compilation error saying
> org.postgresql.util.PSQLException: Cannot cast an instance of [I to
> type Types.ARRAY

Currently the driver only supports passing a specific implementation of
java.sql.Array to setObject (and setArray). Other people have posted
helper classes to transform some specific java array types to
java.sql.Array, but these have not been generalized and added to the
driver.

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-11-13 09:27:08 Re: prepareThreshold=1 and statement.executeBatch() ??
Previous Message Joost Kraaijeveld 2005-11-13 06:48:05 prepareThreshold=1 and statement.executeBatch() ??