> I'm inserting a new row in a table using an Insert SQL query.
> One of the fields is an Identity (Autonumber) field, which
> is the unique value for the row.
> I execute the SQL statement and the row is inserted
> properly using a JDBC driver.
> My problem: How do I grab the value of the identity
> field in that newly added row? The ResultSet doesn't
> have the information because it was an INSERT query.
> What I'm doing must be possible, right?
> ---
> Brian Leach
Yes. Just run the SQL you'd run if you were in isql to see it.
For MS SQLServer or Sybase, I believe it's
So you'd run that query through any statement made from the same
JDBC connection as you made the update. (It could be the same
statement).
Joe Weinstein at BEA, the home of WebLogic
--
PS: Folks: BEA WebLogic is in S.F. with both entry and advanced positions for
people who want to work with Java, XML, SOAP and E-Commerce infrastructure
--------------------------------------------------------------------------------
The Weblogic Application Server from BEA
JavaWorld Editor's Choice Award: Best Web Application Server
Java Developer's Journal Editor's Choice Award: Best Web Application Server
Crossroads A-List Award: Rapid Application Development Tools for Java
Intelligent Enterprise RealWare: Best Application Using a Component Architecture
http://www.bea.com/press/awards_weblogic.html