[Pljava-dev] Cannot obtain java.sql.Array from java.sql.ResultSet getArray() method call

From: mtsahakis at gmail(dot)com (Manos Tsahakis)
To:
Subject: [Pljava-dev] Cannot obtain java.sql.Array from java.sql.ResultSet getArray() method call
Date: 2013-02-05 14:37:35
Message-ID: CABuvXqoMRyUBBuC3KnWz4qKP5J7Oe-F9oGGDgYvwwAZ1W8FWFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hello all,

We are currently experimenting on our development environment with pl/java
and thinking of using postgres functions from already existing static java
methods.

We encountered a problem when trying to retrieve data stored as smallint[]
on a postgres table:

Cannot derive a value of class java.sql.Array from an object of class
[Ljava.lang.Short;
java.sql.SQLException: Cannot derive a value of class java.sql.Array from
an object of class [Ljava.lang.Short;

This occurs in line:

java.sql.Array SQLsched = rs.getArray(2);

The workaround is straightforward enough, we can change the above java code
line to:

Short[] work = (Short[])rs.getObject(2);

and alter a bit our flow so as to facilitate this change. However, we are
concerned about memory, given the overhead of a java array of Objects vs.
that of a java primitive array.

Is there another, more efficient workaround than the one I mention above?

Does pl/java implement a specific jdbc specification, and if yes, then
which?

My development environment:

ubuntu 12.04
PostgreSQL 9.0.10 on x86_64-unknown-linux-gnu, compiled by GCC gcc
(Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit
pljava-snapshot.20120525.0

Many thanks in advance,
Manos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20130205/724db4a2/attachment.html>

Browse pljava-dev by date

  From Date Subject
Next Message Manos Tsahakis 2013-02-05 15:29:06 [Pljava-dev] Cannot obtain java.sql.Array from java.sql.ResultSet getArray() method call
Previous Message Thomas Hallgren 2013-02-05 10:41:19 [Pljava-dev] FreeBSD pl/java problem : Solved