passing array as parameters to PrepareStatement or callable statement.[setObject() or setArray()]

Поиск
Список
Период
Сортировка
От Assad Jarrahian
Тема passing array as parameters to PrepareStatement or callable statement.[setObject() or setArray()]
Дата
Msg-id 4bd3e1480511120921y6359a0achab46a321b4802219@mail.gmail.com
обсуждение исходный текст
Ответы Re: passing array as parameters to PrepareStatement or callable  (Kris Jurka <books@ejurka.com>)
Список 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: kevin@mtel.co.uk
Дата:
Сообщение: Re: strange jdbc problem moving to 8.1 database
Следующее
От: Joost Kraaijeveld
Дата:
Сообщение: prepareThreshold=1 and statement.executeBatch() ??