From: Joseph Shraibman <jks@selectacast.net>
To: John Thorhauer <jthorhauer@phoenixcolor.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: jdbc how to get SERIAL
Date: Tue, 18 Jul 2000 15:00:35 -0400
Message-ID: <3974A953.92FF9DD2@selectacast.net> (raw)
References: <3974A3B0.E4D01DED@phoenixcolor.com>
Explictly get the value.
For example:
ResultSet rs = st.executeQuery("select nextval('my_col_name_seq'));
st.next(); int id = st.getInt(1);
st.executeUpdate("insert into mytable values(id = "+id+" , myvalu =
'blah');");
John Thorhauer wrote:
>
> How do I get the id column of a row via jdbc if the column is a SERIAL
> column. I want to get the id of the row after I insert new data via
> jdbc execute command.
>
> Thanks,
> John Thorhauer
>
> --
> ********************************
> ** John Thorhauer
> ** jthorhauer@phoenixcolor.com
> ********************************
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: jks@selectacast.net, jthorhauer@phoenixcolor.com
Subject: Re: jdbc how to get SERIAL
In-Reply-To: <3974A953.92FF9DD2@selectacast.net>
* 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