This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am inserting a row into a table in DB2 and DB2 provides an auto-generated key into the primary key column.
After the insert I am retreiving that value by "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1", but the problem is how do I know that this is the ID that DB2 has generated for the above insert.. How do I ensure that no one else has done an insert and if someone else has done an insert then the IDENTITY_VAL_LOCAL() returns the ID of the second insert...
I am using JDBC 2.0 so I know that I cannot use, RETURN_GENERATED_KEYS in the preparedStatement. Is there any possible way that I can ensure that no one does a second insert until the IDENTITY_VAL_LOCAL() returns a value ?
Please help me out if you know, I would really appreciate your help.