Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 2FBD470E777 for ; Fri, 9 Mar 2012 17:25:37 -0400 (AST) Received: from sam.nabble.com ([216.139.236.26]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S67Je-0007FN-0S for pgsql-jdbc@postgresql.org; Fri, 09 Mar 2012 21:25:36 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1S67JQ-0003Xu-P7 for pgsql-jdbc@postgresql.org; Fri, 09 Mar 2012 13:25:20 -0800 Date: Fri, 9 Mar 2012 13:25:20 -0800 (PST) From: otran To: pgsql-jdbc@postgresql.org Message-ID: <1331328320772-5551763.post@n5.nabble.com> Subject: oid int issue with CachedRowSet upgrading from JDBC 8.4 to 9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -0.8 (/) X-Archive-Number: 201203/18 X-Sequence-Number: 22757 Hi, We are in the process of upgrading from Postgres JDBC 8.4 to 9.1-901-1.jdbc= 4 and discovered that CacheRowSet now call the methods isAutoIncrement() and fetchFieldMetaData(), which will fail converting a OID to an int. The following code works with the 8.4 driver, but fails with 9.1: public static void main(String[] args) throws Exception { Properties connectionProperties =3D new Properties(); connectionProperties.put("user", "otran"); connectionProperties.put("pass", "=E2=80=9D); Class.forName("org.postgresql.Driver"); Connection connection =3D DriverManager.getConnection("jdbc:postgresql://postgres-9.1", connectionProperties); Statement statement =3D connection.createStatement(); ResultSet resultSet =3D statement.executeQuery("select * from airports"); CachedRowSet cachedRowSet =3D new CachedRowSetImpl(); cachedRowSet.populate(resultSet); } $ export CLASSPATH=3Dpostgresql-8.4-702.jdbc4.jar:. $ java Test $ export CLASSPATH=3Dpostgresql-9.1-901-1.jdbc4.jar:. $ java Test Exception in thread "main" org.postgresql.util.PSQLException: Bad value for type int : 3090704121 at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.ja= va:2731) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.j= ava:1983) at org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData.fetchFieldMetaData(Abst= ractJdbc2ResultSetMetaData.java:242) at org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData.isAutoIncrement(Abstrac= tJdbc2ResultSetMetaData.java:61) at com.sun.rowset.CachedRowSetImpl.initMetaData(CachedRowSetImpl.java:701) at com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:621) at Test.main(Test.java:22) It only affects our production environments where the oids are larger than an int, but many of our tables have that issue. We can try ripping out CachedRowSets, but wonder if someone has a fix. Seems related to: RELEASE NOTE...=20 With Version 89.3-dev600 (2007-04-18). Make the default object return type of oids to be a Java Long instead of Integer because oids are unsigned and exceed the range of Integer. (jurka) http://postgresql.1045698.n5.nabble.com/oid-as-long-type-td2169988.html Thanks, Owen -- View this message in context: http://postgresql.1045698.n5.nabble.com/oid-i= nt-issue-with-CachedRowSet-upgrading-from-JDBC-8-4-to-9-1-tp5551763p5551763= .html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.