|
Home > Archive > PostgreSQL JDBC > November 2005 > Re: passing array as parameters to PrepareStatement or callable
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: passing array as parameters to PrepareStatement or callable
|
|
| Kris Jurka 2005-11-13, 3:23 am |
|
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
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
| |
| Oliver Jowett 2005-11-20, 8:24 pm |
| Jojo Paderes wrote:
> Is the Array class used in the method refers to java.sql.Array? If
> yes, I think it's not possible to use that to create an object since
> it is an interface.
Yes it's java.sql.Array, but the code is creating an instance of an
anonymous inner class that implements Array, which is fine:
[color=darkred]
[...]
-O
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
|
|
|
|
|