Received: from awcoldstream.com ([206.130.14.2]) by hub.org (8.8.8/8.7.5) with ESMTP id AAA16219 for ; Sat, 9 May 1998 00:48:34 -0400 (EDT) Received: from awcoldstream.com (206.248.140.78) by awcoldstream.com with ESMTP (Apple Internet Mail Server 1.1.1); Fri, 8 May 1998 23:46:14 -0500 Message-ID: <3553E222.1DFF7079@awcoldstream.com> Date: Fri, 08 May 1998 23:57:06 -0500 From: Anil Amarakoon X-Mailer: Mozilla 4.04 [en] (WinNT; I) MIME-Version: 1.0 To: Felix Morley Finch CC: "pgsql-interfaces@postgreSQL.org" Subject: Re: [INTERFACES] jdbc can't getResult of "select nextval (seq_name)" References: <19980508233604.14173.qmail@crowfix.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! I am no expert but this works for me. try { Connection conn=DriverManager.getConnection("jdbc:postgresql://myserver:5432/mydb","userName","password"); Statement stmt = conn.createStatement(); ResultSet rest = stmt.executeQuery("select last_value from cid "); while (rest.next()) int myint = rest.getInt(1); } catch(SQLException sqle) { sqle.printStackTrace(); } bla bla bla again..... on psql if you go type select * from mysequence; you will see what variables you can access. I am not sure it is last_value or last value or current value. sorry!!! Hope this helps. Anil Felix Morley Finch wrote: > 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); <=========