pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nebojsa Vasiljevic <nebojsa@sw4i.com>
To: Amit Handa <Amit.Handa@Sun.COM>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Cc: kmacclay@vantage.com
Cc: bmaguire@vantage.com
Cc: Amit Handa <Amit.Handa@Sun.COM>
Subject: Re: SQLException: Invalid precision value. Cannot be less than zero
Date: Thu, 10 Feb 2005 11:49:34 +0100
Message-ID: <006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu> (raw)
References: <000901c50ef7$b787f9e0$ad00a8c0@mediacenter.org.yu>
	<Pine.BSO.4.56.0502100304200.6761@leary.csoft.net>
	<420B3428.8030309@sun.com>



> 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 




view thread (7+ messages)  latest in thread

Message-ID: <006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu>
Permalink:  ../006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu/
Also on:    postgresql.org/message-id/006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: nebojsa@sw4i.com, Amit.Handa@Sun.COM, books@ejurka.com, kmacclay@vantage.com, bmaguire@vantage.com
  Subject: Re: SQLException: Invalid precision value. Cannot be less than zero
  In-Reply-To: <006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu>
  References: <000901c50ef7$b787f9e0$ad00a8c0@mediacenter.org.yu> <Pine.BSO.4.56.0502100304200.6761@leary.csoft.net> <420B3428.8030309@sun.com> <006a01c50f5e$35f57b70$ad00a8c0@mediacenter.org.yu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox