Re: Help with Array

Поиск
Список
Период
Сортировка
От Aaron Bono
Тема Re: Help with Array
Дата
Msg-id bf05e51c0701081035j5e11a575r23d54f44764774a5@mail.gmail.com
обсуждение исходный текст
Ответ на Help with Array  ("Jeremiah Elliott" <geek00@gmail.com>)
Список pgsql-sql
On 1/8/07, Jeremiah Elliott <geek00@gmail.com> wrote:
I have a java application that moves data from our erp platform
(progress) into a Postgres database. One of the fields in progress is
a character array. I haven't had any luck getting this field to
transfer. What I would like to do is something like:

....
preparedStatement.setArray(i,resultSet.getArray(i));
....

however this throws java.lang.UnsupportedOperationException
I have tried several other ways, with no luck.

...
preparedStatement.setObject (i,resultSet.getObject(i));
...
throws
java.sql.SQLException: ERROR: column "so_slspsn" is of type character
varying[] but expression is of type character varying


and

...
preparedStatement.setObject (i,resultSet.getObject(i),2003);
...
throws
org.postgresql.util.PSQLException: Unsupported Types value: 2,003


What am i doing wrong?


For your first attempt, it looks to me like one of the JDBC drivers you are using doesn't support Arrays.  I would start by separating out the setArray and getArray onto separate lines of code to see which is the offender.

The second one using get/setObject shows that the data types don't match.  Regardless of how you approach it you are probably going to need to do some type conversion in your Java application itself.  Do a query on both tables and then dig through the Meta Data on your result set to see what the JDBC data types are so you know what you are getting with the get/setObject methods.

It may be better to ask a JDBC group.

--
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================

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

Предыдущее
От: "Jeremiah Elliott"
Дата:
Сообщение: Help with Array
Следующее
От: Curtis Scheer
Дата:
Сообщение: Table relationships