Received: from crowfix.com (qmailr@crowfix.crowfix.com [207.228.46.42]) by hub.org (8.8.8/8.7.5) with SMTP id TAA07283 for ; Fri, 8 May 1998 19:35:55 -0400 (EDT) Received: (qmail 14174 invoked by uid 501); 8 May 1998 23:36:04 -0000 Date: 8 May 1998 23:36:04 -0000 Message-ID: <19980508233604.14173.qmail@crowfix.com> From: Felix Morley Finch To: "pgsql-interfaces@postgreSQL.org" Subject: jdbc can't getResult of "select nextval (seq_name)" X-Mailer: VM 6.34 under Emacs 20.2.1 I am a somewhat newbie with java and sql. I've run into something that seems odd, maybe even wrong (!). Statement seq = db.createStatement (); seq.execute ("SELECT nextval ('cdid')"); ResultSet rs = seq.getResultSet (); id = rs.getInt (0 + 1); <========= The SQL works fine directly in psql. All other SQL statements seem to work. But getInt, in this case, gets a NullPointerException. Here's the stack dump: Exception occurred during event dispatching: java.lang.NullPointerException: at postgresql.ResultSet.getString(ResultSet.java:161) at postgresql.ResultSet.getInt(ResultSet.java:241) at postgresql.ResultSet.getInt(ResultSet.java:569) ... If I change the argument to 0, I get java.sql.SQLException: Column Index out of range I tried 'nextval' too, and got the same SQLException. Am I doing something wrong here? This is PostgresQL 6.3.2, Linux 2.0.33, glibc, and linux jdk 1.1.5v5 glibc. I have no problems with the Perl program which does the same operation many places. -- ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._. Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com PGP = 91 B3 94 7C E9 E8 76 2D E1 63 51 AA A0 48 89 2F ITAR license #4933 I've found a solution to Fermat's Last Theorem but I see I've run out of room o