| From: | Christoph Jaeger <cja(at)eulox(dot)net> |
|---|---|
| To: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | sequence problems |
| Date: | 2001-04-04 15:30:42 |
| Message-ID: | 20010404173042.A23586@eulox.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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 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
christoph(dot)jaeger(at)eulox(dot)net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gabriel García | 2001-04-04 15:48:07 | How connect JDBC |
| Previous Message | Heather Grace | 2001-04-04 13:42:48 | where to find most recent jdbc driver |