Welcome Guest! Log in
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…


Using transactions in SQL is very usefull. Having the possibility to rollback in case an error occured is really interesting.

It is possible to use transactions easily in Stambia, with the SQL Operation process action.

This articles shows an example of how to do this in a process.

 

The SQL Operation Action

The use of transactions with SQL Operations is done through specific parameters.

The most commons are:

SQL Transaction Type

Used to indicate the type of the transaction.

Available types: COMMIT,NOCOMMIT,AUTOCOMMIT,AUTONOMOUS

SQL Transaction Name Name of the transaction

 

To do multiple operations using the same transaction, the same SQL Transaction Name has to be put on each of the actions.

By default the actions have AUTOCOMMIT type. More informations on the types can be found in the Designer's help.

 

Example

Here is a little example in which we want to do some operations, and rollback everything if an error occured, or commit otherwise.

Process overview:

Overview

 

All the actions are on same transaction: T1 .

The three first ones are using NOCOMMIT Transaction Type.

The last one uses the COMMIT type, in order to send a commit after the action.

 

With this settings, all the actions will be executed within the same JDBC Connection without doing any commit, except the last one.

So, if everything worked during the process, the last action is executed and the commit done.

But if an error occured, the process will end with errors and stop, the Commit action will then not be executed, so no commit will be performed.

In case of a process ending with errors, the runtime is doing automatically a rollback. As all the other actions here have NOCOMMIT type, the last commit on which the rollback will be done is before the execution.

 

Example of execution:

error

 

Here one of the actions failed. A rollback will be executed, and the operations performed by the two successfull one's will not be saved.

Articles

Suggest a new Article!