Received: from p1.selectacast.net (IDENT:root@p1.selectacast.net [206.41.1.251]) by hub.org (8.10.1/8.10.1) with ESMTP id e6ILGqh11813 for ; Tue, 18 Jul 2000 17:16:52 -0400 (EDT) Received: from selectacast.net (IDENT:jks@d1 [209.219.91.66]) by p1.selectacast.net (8.9.3/8.9.3) with ESMTP id RAA18594; Tue, 18 Jul 2000 17:15:49 -0400 Message-ID: <3974C904.E939E842@selectacast.net> Date: Tue, 18 Jul 2000 17:15:48 -0400 From: Joseph Shraibman Organization: Xtenit X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.15 i686) X-Accept-Language: en MIME-Version: 1.0 To: Wim Ceulemans CC: John Thorhauer , pgsql-interfaces@postgresql.org Subject: Re: jdbc how to get SERIAL References: <3974A3B0.E4D01DED@phoenixcolor.com> <3974A953.92FF9DD2@selectacast.net> <3974B666.9FF13F1C@nice.be> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200007/132 Wim Ceulemans wrote: > > Joseph Shraibman wrote: > > > > 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 > > > > > Doesn't it have to be currval in stead of nextval? > No, you want to do an insert, to you need to get the nextval.