Re: SQLException: Invalid precision value. Cannot be less than zero

From: "Nebojsa Vasiljevic" <nebojsa(at)sw4i(dot)com>
To: "Amit Handa" <Amit(dot)Handa(at)Sun(dot)COM>, "Kris Jurka" <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>, <kmacclay(at)vantage(dot)com>, <bmaguire(at)vantage(dot)com>, "Amit Handa" <Amit(dot)Handa(at)Sun(dot)COM>
Subject: Re: SQLException: Invalid precision value. Cannot be less than zero
Date: 2005-02-10 10:49:34
Message-ID: 006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> That's right we *can't change the spec*.
>
> But hold on guys, I can put a try catch block for this and prevent
> the SQLException from being thrown in the implementation,
> wherever it is being called in from *other classes*.
> And hence we can go on.
>
> But yes I can't change the spec class from doing that.
> It's(return -1 for variable length data) is used by various JDBC drivers
> that way.
>
> Does that help ?

Method

javax.sql.rowset.RowSetMetaDataImpl.setColumnDisplaySize()

throws exception after it is called from:

com.sun.rowset.CachedRowSetImpl.initMetaData(CachedRowSetImpl.java:679)

If you catch exception in CachedRowSetImpl.java, you have to decide what
value
to put in columnDisplaySize property. Possible answer is:

If columnDisplaySize, precision or scale property of ResultSetMetaData is -1
then appropriate property of RowSetMetaDataImpl will be 0.

(and you don't need try/catcher to do that)

If various JDBC drivers use -1, this may be reasonable solution.

Nebojsa

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kenneth Hutchinson 2005-02-10 14:49:51 Re: Crystal Reports / PostgreSQL
Previous Message Amit Handa 2005-02-10 10:15:04 Re: SQLException: Invalid precision value. Cannot be less than