Re: Help with Array

From: "Aaron Bono" <postgresql(at)aranya(dot)com>
To: "Jeremiah Elliott" <geek00(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Help with Array
Date: 2007-01-08 18:35:23
Message-ID: bf05e51c0701081035j5e11a575r23d54f44764774a5@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 1/8/07, Jeremiah Elliott <geek00(at)gmail(dot)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
==================================================================

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Curtis Scheer 2007-01-08 21:39:31 Table relationships
Previous Message Jeremiah Elliott 2007-01-08 17:24:45 Help with Array