X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8DA7C8B9E41 for ; Wed, 9 Feb 2005 22:36:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48183-08 for ; Wed, 9 Feb 2005 22:36:03 +0000 (GMT) Received: from mail.b92.net (free.b92.net [212.102.128.4]) by svr1.postgresql.org (Postfix) with ESMTP id E711E8B9B26 for ; Wed, 9 Feb 2005 22:36:00 +0000 (GMT) Received: (qmail 12740 invoked from network); 9 Feb 2005 22:35:57 -0000 Received: from nbg-i101.dial.b92.net (HELO nebojsa) (212.102.134.234) by mail.b92.net with SMTP; 9 Feb 2005 22:35:56 -0000 Message-ID: <000901c50ef7$b787f9e0$ad00a8c0@mediacenter.org.yu> From: "Nebojsa Vasiljevic" To: Subject: SQLException: Invalid precision value. Cannot be less than zero Date: Wed, 9 Feb 2005 23:35:54 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-2"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/50 X-Sequence-Number: 12230 The exception occures in populate() method: CachedRowSetImpl rowSet = new CachedRowSetImpl(); r=as.executeQuery("select * from an_tnratio"); rowSet.populate(r); Table definition is: -- Table: an_tnratio -- DROP TABLE an_tnratio; CREATE TABLE an_tnratio ( ssize text, edulh text, tnratio numeric ) WITH OIDS; ALTER TABLE an_tnratio OWNER TO elan; Stack trace: java.sql.SQLException: Invalid column display size. Cannot be less than zero at javax.sql.rowset.RowSetMetaDataImpl.setColumnDisplaySize(RowSetMetaDataImpl.java:267) at com.sun.rowset.CachedRowSetImpl.initMetaData(CachedRowSetImpl.java:679) at com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:597) at com.sw4i.elan.engine.Table$1.doo(Table.java:51) ... Driver version: 8.0-310 (postgresql-8.0-310.jdbc3.jar) Sun JDK version: 1.5.0_01-b08 Database PosgreSQL 8.0.0 on i686-pc-mingw32, compiled by GCC gcc.exe(GCC) 3.4.2 (mingw-special) The problem is "return -1" statement in org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData.getPrecision(): case Types.NUMERIC: Field f = getField(column); if (f != null) { // no specified precision or scale if (f.getMod() == -1) { return -1; } return ((0xFFFF0000)&f.getMod()) >> 16; } else { return 0; } After I have pached getPrecision(), getScale() and getColumnDisplaySize() to return 0 instead of negative value, my program works fine. I haven't find in JDBC specification what those methods should return for "unknown/unspecified", but other drivers (like JdbcOdbcDriver) returns 0. Nebojsa Vasiljevic