The two-phase commit (also known as "2PC") means that the transaction manager first sends out a "prepare for commit" message to all participants and starts waiting for acknowledgement messages. Once the owner has received "OK" from every participant, it sends out a "commit" message. If it didn't receive an OK from some participant, it sends out a "rollback" message to all participants. When talking about a single phase commit, the transaction manager only sends out one message, "commit". The reason why 2PC is needed is distributed transactions. For example, you might have two separate databases being modified within a single transaction. If we have committed the first modification but the second fails, there's no way to rollback the first one anymore. For a better and more thorough/accurate explanation for 2PC, consult Google. As to your question about which of these is JDBC using, it uses both. At least in theory. If you have an XA-capable JDBC driver, it should be able to implement the 2PC protocol as well as the normal single-phase commit protocol.
Post by:autobot
Where does a nanny get ground to air missles? Protect this tiny ad:
a bit of art, as a gift, that will fit in a stocking