my dog learned polymorphism*
The moose likes JDBC and the fly likes DBLinks and Two Phase Commit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DBLinks and Two Phase Commit" Watch "DBLinks and Two Phase Commit" New topic
Author

DBLinks and Two Phase Commit

Amber Vaidya
Ranch Hand

Joined: Oct 14, 2003
Posts: 42
Hi,

I have a system that needs to update two databases (both Oracle 10g) in a single transaction.
The question is; if I create a DBLink between the two Oracle databases and treat this transaction as a normal transaction (not XA) would it work?

The system is a standalone java application (not deployed on any web/app server) and I am using Spring for JDBC.

If you think that the above approach will not work, can you please suggest an alternative?

Thanks in advance !!
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
Yes - Oracle - Ejb Transaction Across Database Links

This article is about EJBs but it applies because the transaction is done simply by using the same connection. So you could execute both statements and only call commit if they both succeed.

You could also do an XA transaction via JTA pretty easy in Spring via JBossTS.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DBLinks and Two Phase Commit
 
Similar Threads
Synchronizing Two Databases
Trasactions in EJB
Is there a generic way to get sequence
Which JDBC driver
SQL Sysntax Error.