Skip site navigation (1) Skip section navigation (2)

Problem with jdbc, nextval ('myseq'), and rs.getInt (1) - SOLVED

From: Felix Morley Finch <felix(at)crowfix(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Problem with jdbc, nextval ('myseq'), and rs.getInt (1) - SOLVED
Date: 1998-05-10 00:16:11
Message-ID: 19980510001611.19433.qmail@crowfix.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
Well, heck, if I ever need proof I'm not perfect, I just got it :-)

I had this code which gave me a null pointer exception with clumn 1,
or SQLException for column 0:

	seq.execute ("SELECT nextval ('myseq')");
	ResultSet rs = seq.getResultSet ();
	id = rs.getInt (1);

The problem was, I had forgotten to include this statement --

	rs.next ();

which makes it all work fine.

Doh!

-- 
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
     Felix Finch: scarecrow repairman & rocket surgeon / felix(at)crowfix(dot)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

pgsql-interfaces by date

Next:From: Sbragion DenisDate: 1998-05-11 08:04:03
Subject: New ODBC Driver: some tests.
Previous:From: Byron NikolaidisDate: 1998-05-10 00:15:37
Subject: Re: [INTERFACES] NEW ODBC DRIVER

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group