retrieving PK after insertRow()
I am doing a simple db operation using a resultset. Below is my code for an INSERT:
Now i want to return the PK ID that was created in the database. But rs.getInt("PrimaryKeyRow") always returns 0, although i see in my DB that the row has got an ID. How can I get the generated ID? And I do NOT want to use a method that does not let me edit a resultset (meaning I do not want to build a query and send it to rs.execute(sqlStatement, Statement.RETURN_GENERATED_KEYS), as I want to loop through the set and make updates and inserts depending on the existing rows).
stmt = connection.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * FROM table LIMIT 0");