Icon

13_​DBTransactionExample

Working with Database Transactions

The DB Transaction Start and DB Transaction End nodes allow you to model a database transaction, i.e. a unit of work that is either completely processed or not at all. So, if all nodes between the DB Transaction Start and DB Transaction End nodes execute successfully, all changes will be persisted in the database. Likewise, if any of the nodes between the two transaction nodes fails, none of the changes will be persisted in the database.

Note that most databases do an implicit commit when executing a DDL statement such as create or drop table even within a transaction.


All DB commands between the DB Transaction Start and DB Transaction End nodeswill be executed within the same database transaction. So either all succeed or none. This workflow demonstrates how to use the DB Transaction Start and DB Transaction End nodes to perform database transaction. For more information see the workflow metadata. Find it here: View -> Description. Output ports:1: DB Connection (always active)2: Flow Variable (active on success)3: Folw Variable (active on failure) Execute DDL nodes outside the transactionsince in most databasesthey cause a commit!Fails due toduplicate keySend email on failure (needs configuration)Workflow nameH2 Connector DB TransactionStart DB Transaction End DB Table Creator DB Insert DB ConnectionExtractor DB Insert DB ConnectionExtractor GenerateExample Data Send Email Extract ContextProperties All DB commands between the DB Transaction Start and DB Transaction End nodeswill be executed within the same database transaction. So either all succeed or none. This workflow demonstrates how to use the DB Transaction Start and DB Transaction End nodes to perform database transaction. For more information see the workflow metadata. Find it here: View -> Description. Output ports:1: DB Connection (always active)2: Flow Variable (active on success)3: Folw Variable (active on failure)Execute DDL nodes outside the transactionsince in most databasesthey cause a commit!Fails due toduplicate keySend email on failure (needs configuration)Workflow nameH2 Connector DB TransactionStart DB Transaction End DB Table Creator DB Insert DB ConnectionExtractor DB Insert DB ConnectionExtractor GenerateExample Data Send Email Extract ContextProperties

Nodes

Extensions

Links