• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to retrieve the new ID of the auto_increment column

 
Keya Shah
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65680
129
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a JSP question; moving along to the JDBC forum.
 
Roberto Spier
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Keya,

I do it this way:


HTH
Roberto
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!