Rollback Transaction Version 9 (Java)

Action group: Databases


Description

Action rolls back the current transaction

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
DB contextConnection context to the selected databaseRobin.DbContextDatabase contextYes

Special conditions of use

None.

Example of use

Task

Connect to the database, execute the query:

Первый запрос
UPDATE Table1 SET title = 'Car' WHERE id=2

Then rollback the transaction and execute the following request:

Второй запрос
UPDATE Table1 SET title = 'Phone' WHERE id=3

At the end, close the transaction.

Initial view of the table:

Solution

Use the actions "Connect Standard Db", "Execute Sql Statement", "Rollback Transaction", "Commit Transaction". 

Implementation

  1. Assemble a robot scheme consisting of actions:


  2. Set the parameters for the "Connect Standard Db" action (Instructions on how to connect to Microsoft SQL Server from Robin Studio).


  3. Set the parameters for the "Execute Sql Statement 1" action. 


  4. Set the parameters for the "Rollback Transaction" action. 


  5. Set the parameters of the next action "Execute Sql Statement 2".


  6. Set the parameters of the "Commit Transaction" action.


  7. Click on the "Start" button in the top panel. 

Result

The program robot completed successfully.

The first transaction rolled back, so the changes were not applied to the database. The second transaction was closed and applied to the database:

  • Нет меток