From: Guillaume Cottenceau <gc@mnc.ch>
To: Daniel Schaedler <postgres-jdbc@daniel.schaedler.name>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: problem to get nextval of a sequence
Date: 28 Dec 2004 14:19:04 +0100
Message-ID: <87zmzyblx3.fsf@meuh.mnc.ch> (raw)
In-Reply-To: <41D15580.3050700@daniel.schaedler.name>
References: <41D15580.3050700@daniel.schaedler.name>
Daniel Schaedler <postgres-jdbc 'at' daniel.schaedler.name> writes:
> Hi List
>
> I try to get the 'nextval' of a sequence:
> ***
> String query = "SELECT nextval('nodes_nodeid_seq')";
> pstmt = conn.prepareStatement(query);
> logger.debug("statement: " + pstmt.toString());
> ResultSet ress = pstmt.executeQuery();
> long newID = ress.getLong("nextval"); // <-- Exception
> ***
>
> I get the following Exception:
> ***
> org.postgresql.util.PSQLException: ResultSet not positioned properly,
> perhaps you need to call next.
"perhaps you need to call next".
Have you tried calling next?
--
Guillaume Cottenceau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: gc@mnc.ch, postgres-jdbc@daniel.schaedler.name
Subject: Re: problem to get nextval of a sequence
In-Reply-To: <87zmzyblx3.fsf@meuh.mnc.ch>
References: <41D15580.3050700@daniel.schaedler.name> <87zmzyblx3.fsf@meuh.mnc.ch>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox