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

Поиск
Список
Период
Сортировка
От Nebojsa Vasiljevic
Тема Re: SQLException: Invalid precision value. Cannot be less than zero
Дата
Msg-id 006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu
обсуждение исходный текст
Ответ на SQLException: Invalid precision value. Cannot be less than zero  ("Nebojsa Vasiljevic" <nebojsa@sw4i.com>)
Список 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


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Nebojsa Vasiljevic"
Дата:
Сообщение: Re: SQLException: Invalid precision value. Cannot be less than zero
Следующее
От: "Kenneth Hutchinson"
Дата:
Сообщение: Re: Crystal Reports / PostgreSQL