XADataSource is used when ur
j2ee application wants to participate in distributed Transaction (two or more database) at that time ur driver should implement javax.sql.XADataSource interface to participate in the transaction to lead to ACID rules.
2 phase commit protocol is the protocol followed by the transaction manager(JTS) to keep the all resource managers in sync for commiting the transaction .
i have the explanation is enough to clarify ur question