Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B58659FB20F for ; Mon, 8 Jan 2007 14:35:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 69745-10 for ; Mon, 8 Jan 2007 14:35:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.224]) by postgresql.org (Postfix) with ESMTP id 8ADB39FB1D3 for ; Mon, 8 Jan 2007 14:35:25 -0400 (AST) Received: by wr-out-0506.google.com with SMTP id i31so138135wra for ; Mon, 08 Jan 2007 10:35:24 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=Mzfsngoz6JL2MQ+WDRXniuMRVSWMKADZQOAuKKAfzzTSlVgVu/bmNFuk+EXtVrUpiQhSgd3k7zjmzAoNIqq7nxbAdbeAIKALY5pAeZ2/f1g8FRZNv4P2u21mYMrsQwH8IfAETPmsLO7Ih8P9FmHavVHcwGyjUyG9XYNen9Eu324= Received: by 10.78.185.7 with SMTP id i7mr4168352huf.1168281323762; Mon, 08 Jan 2007 10:35:23 -0800 (PST) Received: by 10.78.57.4 with HTTP; Mon, 8 Jan 2007 10:35:23 -0800 (PST) Message-ID: Date: Mon, 8 Jan 2007 12:35:23 -0600 From: "Aaron Bono" To: "Jeremiah Elliott" Subject: Re: Help with Array Cc: pgsql-sql@postgresql.org In-Reply-To: <17eca7f50701080924h2faa6286yfc9b7758a69a3f0@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_53838_28197595.1168281323403" References: <17eca7f50701080924h2faa6286yfc9b7758a69a3f0@mail.gmail.com> X-Google-Sender-Auth: 4dd61de8d132cdf6 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/15 X-Sequence-Number: 27167 ------=_Part_53838_28197595.1168281323403 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/8/07, Jeremiah Elliott 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 ================================================================== ------=_Part_53838_28197595.1168281323403 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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
================================================================== ------=_Part_53838_28197595.1168281323403--