From: | Assad Jarrahian <jarraa(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | passing array as parameters to PrepareStatement or callable statement.[setObject() or setArray()] |
Date: | 2005-11-12 17:21:32 |
Message-ID: | 4bd3e1480511120921y6359a0achab46a321b4802219@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1637)
at org.postgresql.jdbc3.AbstractJdbc3Statement.setObject(AbstractJdbc3Statement.java:1435)
at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1652)
at //the setObjectLineAbove
IF I change it to type Integer[]
org.postgresql.util.PSQLException: Cannot cast an instance of
[Ljava.lang.Integer; to type Types.ARRAY
at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1637)
......
I notice Dave Cramer mentioned something about this could be an
easier process. But what is the process now? (aka, am I completely
off?)
Much thanks in advance.
Assad
From | Date | Subject | |
---|---|---|---|
Next Message | Joost Kraaijeveld | 2005-11-13 06:48:05 | prepareThreshold=1 and statement.executeBatch() ?? |
Previous Message | kevin | 2005-11-12 11:56:03 | Re: strange jdbc problem moving to 8.1 database |