Transaction Across Multiple Databases


General J2EE: Transaction Across Multiple Databases

  1. Transaction Across Multiple Databases (1 messages)

    Hi All,

    How can we managa transactions across more than one database say with oracle and sybase with weblogic 6.0. If possible please put forward the code skeleton.

  2. I hope you are using BMP entity beans or sesssion bean persistence, because I have not found a way to change databases with CMP entity beans. You need to be able to change the datasource when persisting information. We scoped this out at my last job and it was a big deal to change. Luckily, we were using BMP entity beans or we couldn't have done it without changing out our persistence layer. This is just another reason of many not to use CMP entity beans. The killer with BMP entity beans is that you have no control over what is happening in ejbload and ejbstore. Basically, you can't assign the datasource to the entity bean on the fly. We discovered a trick when using CMP. The trick is to pass in and store the datasource in the primary key class. You use that datasource attribute when doing an ejbload and store (of course, there are other methods affected). This should give you some ideas.

    Good luck