Testing whether the current row was inserted into a ResultSet in a JDBC application

If a ResultSet is dynamic, you can insert rows into it. After you insert rows into a ResultSet you might need to know which rows were inserted.

Procedure

To test whether the current row in a ResultSet was inserted, follow these steps:

  1. Call the DatabaseMetaData.ownInsertsAreVisible and DatabaseMetaData.othersInsertsAreVisible methods to determine whether inserts can be visible to the given type of ResultSet.
  2. If inserts can be visible to the ResultSet, call the DatabaseMetaData.insertsAreDetected method to determine whether the given type of ResultSet can detect inserts.
  3. If the ResultSet can detect inserts, call the ResultSet.rowInserted method to determine whether the current row was inserted.