EJB programming & troubleshooting: Container Managed Transactions using Multiple Data Sources

  1. How do I set up an EJB in CMT where the EJB uses two data sources? I currently have every method in the EJB as transaction 'Required'. The problem is when I try to use a second data source I get an exception. One data source is Oracle and the other is DB2. Is it not possible to have a method be CMT that access two different data sources? If so, how do I set up the transaction so that I don't get an exception.
  2. Hi

    As you are using EJBs do define two seperate DataSources for the 2 different Databases.
    1. Select and XA driver for the first one.
    2. Set Emulate Two-Phase Commit for non-XA Driver to true for the Second Datasource.

    Now use this 2 Data Sources from a common method It should work.

    Thanks and Regards
    Sabyasachi Chowdhury