From: Aaron Bono <postgresql@aranya.com>
To: Jeremiah Elliott <geek00@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Help with Array
Date: Mon, 8 Jan 2007 12:35:23 -0600
Message-ID: <bf05e51c0701081035j5e11a575r23d54f44764774a5@mail.gmail.com> (raw)
In-Reply-To: <17eca7f50701080924h2faa6286yfc9b7758a69a3f0@mail.gmail.com>
References: <17eca7f50701080924h2faa6286yfc9b7758a69a3f0@mail.gmail.com>
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.comhttp://codeelixir.com
==================================================================
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: postgresql@aranya.com, geek00@gmail.com
Subject: Re: Help with Array
In-Reply-To: <bf05e51c0701081035j5e11a575r23d54f44764774a5@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox