Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[DBUtils] How to get auto increment field's value ?

 
su nguyen van
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm using DBUTils and there is problem as below :
I need to get auto increment field's value from table(A) that has just created to insert into another table(B).

Please help me if there is any idea.

Thank you very much.
SuNguyen.
 
Wayan Saryada
Ranch Hand
Posts: 105
IntelliJ IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can obtain the generated key using a portion of the code below. Get the last key by iterating the value of ResultSet.

 
su nguyen van
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very for your reply.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These Statement.RETURN_GENERATED_KEYS which are extracted with the help of the tmt.getGeneratedKeys() will be returning the values of rownum if the database is of Oracle ? Or it will return success indication or what ??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic