Re: SQLException: Cannot be less than zero

From: Kris Jurka <books(at)ejurka(dot)com>
To: xavier(dot)marquis(at)cegetel(dot)net
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: SQLException: Cannot be less than zero
Date: 2005-07-13 17:27:54
Message-ID: Pine.BSO.4.56.0507131223490.10464@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 13 Jul 2005 xavier(dot)marquis(at)cegetel(dot)net wrote:

> I use PostgreSQL 8.0.3 and I want to use CachedRowSetImpl to populate
> one row in the following table :
>
> CREATE TABLE "Form2"
> (
> form2member3 int4,
> form2member5 int8[],
> )
>
> The second column (an array of bigint) seems to cause the following
> exception when try to populate :
>
> java.sql.SQLException: Invalid column display size. Cannot be less than zero
> at javax.sql.rowset.RowSetMetaDataImpl.setColumnDisplaySize(RowSetMetaDataImpl.java:267)
>
> Has someone yet met and solved this unexpected problem (even momently) ?
> Otherwise, Is there another way to deal with variable-length lists ?

This is a known problem with any variable length data. The postgresql
JDBC driver returns -1 to indicate that the display size is unknown which
the RowSet implementation doesn't seem to like. People have modified the
driver to return 0 in this situation and that allows the rowset to work,
but I don't think it's the right thing to do. In the past someone from
Sun said they'd look into what we should be doing but they never got back
to us.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lenard, Rohan (Rohan) 2005-07-14 00:50:44 Multiple Statement result set problem with PreparedStatements ?
Previous Message xavier.marquis 2005-07-13 17:22:06 SQLException: Cannot be less than zero