This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes how to retrieve the new ID of the auto_increment column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to retrieve the new ID of the auto_increment column" Watch "how to retrieve the new ID of the auto_increment column" New topic
Author

how to retrieve the new ID of the auto_increment column

Keya Shah
Greenhorn

Joined: Sep 13, 2004
Posts: 3
I am using mysql database.
In my jsp page, after inserting a record in the mysql table, I need to get back the new ID generated for the auto_increment primary key column. How do I get this value?

Any help appreciated.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

Not a JSP question; moving along to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Roberto Spier
Greenhorn

Joined: Sep 13, 2004
Posts: 7
Hello, Keya,

I do it this way:


HTH
Roberto
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: how to retrieve the new ID of the auto_increment column
 
It's not a secret anymore!