Hi,
When my SQL statement, say an INSERT statement which is in a try block fails, do i need to do a “explicit ROLLBACK” in my catch block if i want to rollback any of my previous SQL INSERT operations?.
Or is it adviced to throw an exception explicitly inside the catch block so that webMethods itself will ROLLBACK its previous SQL operations?.
Using the Database Adapter for Enterprise Server, SQL statements are only committed when a component script has finished executing.
If TRY-CATCH blocks are used to handle exceptions in a multi-action database script, the script will continue to work towards its finish line and will, at that point, commit the database actions which did not fail.
Therefore, a rollback should be called in the database action CATCH blocks. This will definitively prevent the prior database actions from committing to the database upon the script’s exit.