If an SQL exception occurs in a method that performs multiple database updates, how should the exception be handled to maintain data integrity?

  • Commit all changes made before the exception
  • Ignore the exception and continue with the remaining updates
  • Log the exception and terminate the transaction
  • Rollback all changes made before the exception
When an SQL exception occurs during multiple updates, rolling back all changes made before the exception helps maintain data integrity by ensuring either all updates succeed or none do.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *