Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 phase commit in java !!!!!!!!! URGENT!!!!!!!!!!!

 
parthasarathy madhira
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can I implement 2 phase commit in a standalone java application ?
I access multiple databases with different connection objects in a single class in a single transaction. But how do I implement the 2 phase commit manually in a java standalone application.
Please note that I dont have any environment(like server, jndi etc.,) where i can deploy the datasources.
So pls let me know whether i can implement distributed transactions in this scenario.
This is very urgent.
 
Aman
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use JTA for doing this. You may need to study the JTS and it's specimen implementation with App Servers for using it.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sigh... But JTA requires the implementation of a Transaction Manager -- which are only implemented in applicatoin servers... My question is WHY can't you start up a copy of an application server (even something free like JBoss or Pramati) to act as your Transaction manager and to define your datasources? Then your Java program would just be a normal J2EE Java client... (even though there would be no EJB's or Web apps).
Kyle
 
Akhil Nagpal
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
u dont need to have a application server to make use of TransactionManager. There are many transcation manager available for free like "atomikos TransactionJTA" which provide TransactionManager. Just use its class directly and have your work done by it i.e. 2PC .
Regards,
Akhil Nagpal
 
parthasarathy madhira
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnks a lot Kyle and Nagpal,
I'll surely try your suggestions.
These would be of great help for me probably.

Thanks
Partha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic