File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes maintaining transaction while updating two different databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Distributed Java
Reply locked New topic

maintaining transaction while updating two different databases

Anand Gupta

Joined: Oct 01, 2008
Posts: 2
posted Yesterday 16:48 GMT+0100 (GMT Standard Time)
I am listing down my requirement. Please advise me on how to achieve the desired functionality.

I have two database systems. One is of a ERP package hosted on JBOSS and other is a standalone database with UIs to change data using ejb hosted on Oracle application server. Now the requirement is that whenever I make any change in the stand alone database through its UIs it should be updated in the ERP package in the same transaction boundary and if it is not updated in any one of them the full transaction should be roll-backed. The ERP package has provided APIs to access its database and directly accessing the database is not advisable. Same should be done when I am making any change in the ERP database through its apis same should be replicated in the Standalone database in the same transaction. How should I ensure transaction completeness in this case?
Various options I am looking at are-
1. Invoking the apis of ERP and ejbs of standalone database through web services. Not sure how transaction can be managed through this.
2. Exposing ejbs across ERP database and then invoking both the ejbs together using JTA to ensure transaction completeness.

Other problem is that when I am making the change through the ERP I have to update its database through its provided apis only and I will be inside the JBOSS transaction boundary.
Please guide me on how to achieve this.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

"andyjhs andyjhs", please check your private messages.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Nitesh Kant

Joined: Feb 25, 2007
Posts: 1638

Hi Anand,

Welcome to javaranch. Please do not cross post the same question in different forums.
Let us continue the discussion on this duplicate thread.

apigee, a better way to API!
I agree. Here's the link:
subject: maintaining transaction while updating two different databases
It's not a secret anymore!