Java – get the inserted ID in the same statement
•
Java
There is already an answer to this question: > how to get the insert ID in JDBC? six
Thanks for your help.
John polkley
Solution
Use getgeneratedkeys():
resultSet = pstmt.getGeneratedKeys(); if (resultSet != null && resultSet.next()) { lastId = resultSet.getInt(1); }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码