Java JDBC Get Last Inserted ID

If you don’t like stored procedures wherein the value returned is the last inserted id, you can get it via JDBC code. Using either a Statement or PreparedStatement class, you retrieve the ResultSet using the getGeneratedKeys() method. Sample code below.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *