Re: passing array as parameters to PrepareStatement or callable - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: passing array as parameters to PrepareStatement or callable
Date
Msg-id Pine.BSO.4.61.0511130347040.6118@leary.csoft.net
Whole thread Raw
In response to passing array as parameters to PrepareStatement or callable statement.[setObject() or setArray()]  (Assad Jarrahian <jarraa@gmail.com>)
Responses Re: passing array as parameters to PrepareStatement or callable statement.[setObject() or setArray()]
List 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

pgsql-jdbc by date:

Previous
From: Joost Kraaijeveld
Date:
Subject: prepareThreshold=1 and statement.executeBatch() ??
Next
From: Kris Jurka
Date:
Subject: Re: prepareThreshold=1 and statement.executeBatch() ??