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

Re: jdbc how to get SERIAL

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: John Thorhauer <jthorhauer(at)phoenixcolor(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: jdbc how to get SERIAL
Date: 2000-07-18 19:00:35
Message-ID: 3974A953.92FF9DD2@selectacast.net (view raw or flat)
Thread:
Lists: pgsql-interfaces
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(at)phoenixcolor(dot)com
> ********************************

In response to

Responses

pgsql-interfaces by date

Next:From: Matt FairDate: 2000-07-18 19:02:46
Subject: Re: Connection.setBytes()
Previous:From: Joachim AchtzehnterDate: 2000-07-18 18:54:37
Subject: Re: Connection.setBytes()

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