Re: Help with Array - Mailing list pgsql-sql

From Aaron Bono
Subject Re: Help with Array
Date
Msg-id bf05e51c0701081035j5e11a575r23d54f44764774a5@mail.gmail.com
Whole thread Raw
In response to Help with Array  ("Jeremiah Elliott" <geek00@gmail.com>)
List 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 by date:

Previous
From: "Jeremiah Elliott"
Date:
Subject: Help with Array
Next
From: Curtis Scheer
Date:
Subject: Table relationships