Commit Transaction Version 10 (Java)

Action group: Databases


Description

The action completes the current transaction and confirms all changes that were made within this 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, run a query:

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

Then close the transaction and perform an additional query without closing the transaction:

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

The original view of the table:

Solution

Use the actions "Connect Standard Db", "Execute Sql Statement", "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 "Execute Sql Statement 1" action. 

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


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


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

Result

The program robot completed successfully. The first transaction has been completed. The changes within the first transaction have been confirmed and saved in the database:

The subsequent queries that come after the "Commit Transaction" action are queries of the second transaction that was not closed, accordingly, the query was not executed on the database.

  • Нет меток