This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Distributed Transactions in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Distributed Transactions in Java" Watch "Distributed Transactions in Java" New topic
Author

Distributed Transactions in Java

jim jjoh
Greenhorn

Joined: May 02, 2011
Posts: 5
Hi

I have to do operations in 3 different schema from my application.
I am using Jboss as my application server.
Can you suggest a best way to handle transactions.
I have some theoretical knowledge about 2 phase commit.

Can anyone provide a solution.

Thanks
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

If all three schemas reside in the same database, you might be able (depending on the database) to grant necessary permissions and access all the schemas from a single connection. This way would seem the best to me, as you could completely avoid distributed transactions.

If this is not possible, you'd probably need to use a transaction manager that would coordinate distributed transactions. The details of two-phase commits would be managed by it. To the best of my understanding, most application servers have such a transaction manager. I have no direct experience, but googling up transaction manager jboss brings up this.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

jim jjoh wrote:I have some theoretical knowledge about 2 phase commit.


Do you have any practical experience with usage of 2 phase commit?

In my experience, it rarely works as you wish. Its more a theoretical solution than a real one.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Distributed Transactions in Java
 
Similar Threads
java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrappedConnection using Jboss 4.0GA.
What is CMT and BMT?
freeing up resources when application gets killed
XA transactions and JCA 1.5
Two Phase Commit