Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle JDBC, auto generated keys, JDBC 3.0

 
Sean Sullivan
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is anybody using Oracle9i and JDBC's API for auto generated keys?
Please share details with the rest of us!
http://java.sun.com/products/jdbc/
JDBC 3.0 specification
Section 13.6
Retrieving Auto Generated Keys
"Many database systems have a mechanism that automatically generates a
unique
key field when a row is inserted. The method Statement.getGeneratedKeys,
which can be called to retrieve the value of such a key, returns a ResultSet
object
with a column for each automatically generated key. A flag indicating that
any auto
generated columns should be returned is passed to the methods execute,
executeUpdate or prepareStatement when the statement is executed or
prepared. [...]"
Details:
java.sql.Statement.RETURN_GENERATED_KEYS
java.sql.Statement.getGeneratedKeys()

This article discusses autogenerated keys:
http://www-106.ibm.com/developerworks/java/library/j-jdbcnew/
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sean,
I see you got a reply to this same question that you posted on the OTN forums.
Perhaps you would care to share with us that

Oracle JDBC drivers currenly don't support "Retrieving Auto Generated Keys" , may be we can expect it by 10i or later.

Cheers,
Avi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic