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.
Loading...
Related Quiz
- In the context of web applications, what does the term 'sticky session' mean?
- When implementing CSP, the _________ directive is crucial in restricting resources the page can load.
- What is the primary advantage of using a PreparedStatement in JDBC?
- In MVC architecture, how does a servlet interact with the model to process business logic?
- Load balancing is critical in a _________ architecture to distribute traffic evenly across servers.