Re: Retrieving arrays

From: Bendik Rognlien Johansen <bensmailinglists(at)gmail(dot)com>
To: Markus Schaber <schabi(at)logix-tt(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Retrieving arrays
Date: 2006-10-26 15:30:54
Message-ID: 8EC7B9F5-0A16-4745-ABA6-43A98E9C5D4F@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Morgan Kita 2006-10-27 03:04:36 Applet problems
Previous Message soussou97 2006-10-26 10:34:46 Multiple Joins