jdbc commit transactions

hi experts,
i have a flow service where i am creating five loops and inserting data into five different tables,i.e entering data into each table in each loop.
the question is , i want to make all these five insertions as one transaction,i want to commit only after the fifth table gets succecfully inserted if not i have to rollback all the data entered in remaining tables.
can anybody tell me how can i do it in flow service ,
thanks srikanth

Are you using same transactionName? from starting of the transaction till you commit using wmART services?

What you can do is put a flag under each loop and at the end check the flag if it is true then do comit transaction if not rollback.ofcourse you have to handle rollback transaction for trasient/network failures…


hi RMG
i have five loops and in each loop i am inserting data into a table , i.e into five different tables , i havent used any start transaction ,commit transaction and rollback transaction yet in my flow .
my flow looks like this, can u tell me if i add the steps in the paranthesis below to my flow does it work .

try block
loop 1
insert table 1
loop 2
insert table 2
loop 3
insert table 3
loop 5
insert table 5
catch block
exception handling

can u explain me if there is any better way to make all five loops as a single transaction.
thank you

Your approach is straight forward for insertion,what i am telling is put some flag in the each loop,if true or success then commit thetransaction else false then rollback the transaction.so at any point you will able to handle comit/rollback the whole transactions.

This way you can insert all the five tables in single transaction,since transactionName object will be carried thru all pipeline.


when rollback the transaction, set the transaction name with
%lasterror/pipeline/starttransaction/transactionname%, and select perform variable substitution.