Two-phase commit ensures that distributed transactions (that is, transactions involving multiple databases) occur consistently across all databases. Two-phase commit is not necessary for transactions involving a single database.
For detailed information on two-phase commit, see
DistributedTransaction Processing.