Understanding COM+ Transaction

This sample code, called MTStest.vbp, shows how to create a distributed transaction using COM+. This project contains these two classes:

  • MTSTestClass, which queries and updates a test SQL database.

  • OWTxClass, which runs the Sales Order Entry.

OWTxClass is almost identical to the previous SOETxObject, except that the message box for commit or abort is no longer necessary.

MTStest.dll must be registered in the COM+ Component Services, and the transaction property should be set to required.

Create a sample SQL test database table SOE2PCTest. SOE2PCTest table has two columns, SONum and LastSONum. The test selects the LastSONum and then updates the table by incrementing the previous value by 1 when commit is called.

Sample code called ClientPrj.vbp will call the transactional object.

Both of the transactions are committed by the DTC when the SetComplete call is made. The DTC aborts the transaction when the SetAbort call is made or if any part of the transaction fails.

Use these steps to run a sales order entry as a distributed transaction in COM+ where the COM connector, JD Edwards EnterpriseOne, and an SQL database participate.

  1. Run the MTStest.vbp.

  2. Run the ClientPrj.vbp.

  3. Click the Call Database_ Test_ Method button.

  4. Switch back to the MTStest and note the sales order number.

  5. When a message box appears to Commit or Abort, select the appropriate action.

  6. Verify in JD Edwards EnterpriseOne whether the sales order has been entered. When the transaction is aborted, the sales order should not be in JD Edwards EnterpriseOne, and the test database should not increment the count.