sequence problems - Mailing list pgsql-jdbc

From Christoph Jaeger
Subject sequence problems
Date
Msg-id 20010404173042.A23586@eulox.net
Whole thread Raw
List pgsql-jdbc
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
lotof 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
christoph.jaeger@eulox.net

Attachment

pgsql-jdbc by date:

Previous
From: "Heather Grace"
Date:
Subject: where to find most recent jdbc driver
Next
From: Gabriel García
Date:
Subject: How connect JDBC