Hi!

I have a problems using a serial type field in a table with the jdbc postgres driver.

Table:

create table dummy_user (
  id serial primary key,
  name text
  )

Now I would like to insert a new row into this table.

{
    String name="Hugo";
    PreparedStatement ps=db.prepareStatement("INSERT INTO dummy_user (name) values 
(?)");
    ps.setString(1,name);
    ps.executeUpdate();
    ps.close();
    db.commit();
}

works just fine. The problem is: I could not yet find a way to get the value of the 
field "id" of my newly inserted row. I tried it with an UpdatableResultSet (which 
should work in theory), but it is not yet implemented. I searched a lot of 
mailinglists, but could not find a solution either.

I would be very thankful for any comments helping me solve this problem,

yours,

Christoph
-- 
eulox.net, Wien
software-engineer
[EMAIL PROTECTED]

PGP signature


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to