Hi,

The two phase commit mostly works in a distributed environment where it any of the transaction fails(due crash,powerfailure,etc) it is either comited or rolledback.