pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bendik Rognlien Johansen <bensmailinglists@gmail.com>
To: Markus Schaber <schabi@logix-tt.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Retrieving arrays
Date: Thu, 26 Oct 2006 17:30:54 +0200
Message-ID: <8EC7B9F5-0A16-4745-ABA6-43A98E9C5D4F@gmail.com> (raw)
In-Reply-To: <452F5C6A.9020300@logix-tt.com>
References: <533747B3-BC3C-4D07-A2B8-A3C86B85C718@gmail.com>
	<452CE6B0.10409@logix-tt.com>
	<02302CAD-88BF-445E-A642-40EE4266045B@gmail.com>
	<452CF4ED.9040301@logix-tt.com>
	<06A202FE-D5CB-4087-9838-C3E2AB4181DE@gmail.com>
	<452F5C6A.9020300@logix-tt.com>

Hello again. I have been away for a while.

Column "stringarray" is VARCHAR[]
Column "integerarray" is INTEGER[]

System.out.println("getObject: " + rs.getObject 
("integerarray").getClass());
System.out.println("getObject: " + rs.getObject 
("stringarray").getClass());

System.out.println("getArray: " + rs.getArray("integerarray").getClass 
());
System.out.println("getArray: " + rs.getArray("stringarray").getClass 
());

Regular driver:

getObject: class org.postgresql.jdbc3.Jdbc3Array
getObject: class org.postgresql.jdbc3.Jdbc3Array
getArray: class org.postgresql.jdbc3.Jdbc3Array
getArray: class org.postgresql.jdbc3.Jdbc3Array


PL/Java
getObject: class [Ljava.lang.Integer;
getObject: class [Ljava.lang.String;
ERROR:  java.sql.SQLException: Cannot derive a value of class  
java.sql.Array from an object of class [Ljava.lang.Integer;
ERROR:  java.sql.SQLException: Cannot derive a value of class  
java.sql.Array from an object of class [Ljava.lang.String;

Thanks!


On Oct 13, 2006, at 11:29 AM, Markus Schaber wrote:

> Hi, Bendik,
>
> Bendik Rognlien Johansen wrote:
>
>> In PL/Java:
>> String[] values = (String[]) rs.getObject(column);
>
> What does getArray() return here?



>
>> Regular driver:
>> String[] values = (String[]) rs.getArray(column).getArray();
>
> And what does getObject return here?
>
> Thanks,
> Markus
> -- 
> Markus Schaber | Logical Tracking&Tracing International AG
> Dipl. Inf.     | Software Development GIS
>
> Fight against software patents in Europe! www.ffii.org
> www.nosoftwarepatents.org




view thread (11+ messages)

Message-ID: <8EC7B9F5-0A16-4745-ABA6-43A98E9C5D4F@gmail.com>
Permalink:  ../8EC7B9F5-0A16-4745-ABA6-43A98E9C5D4F@gmail.com/
Also on:    postgresql.org/message-id/8EC7B9F5-0A16-4745-ABA6-43A98E9C5D4F@gmail.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: bensmailinglists@gmail.com, schabi@logix-tt.com
  Subject: Re: Retrieving arrays
  In-Reply-To: <8EC7B9F5-0A16-4745-ABA6-43A98E9C5D4F@gmail.com>
  References: <533747B3-BC3C-4D07-A2B8-A3C86B85C718@gmail.com> <452CE6B0.10409@logix-tt.com> <02302CAD-88BF-445E-A642-40EE4266045B@gmail.com> <452CF4ED.9040301@logix-tt.com> <06A202FE-D5CB-4087-9838-C3E2AB4181DE@gmail.com> <452F5C6A.9020300@logix-tt.com> <8EC7B9F5-0A16-4745-ABA6-43A98E9C5D4F@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