wood burning stoves*
The moose likes JDBC and the fly likes Distributed Transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Distributed Transactions" Watch "Distributed Transactions" New topic
Author

Distributed Transactions

Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
Hi
Can anybody suggest here how to do distributed transactions if the driver(JDBC2.0, DB2) doesn't support the same.
currently we are down to manually rollingback and reverting changes
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Uh, DB2 ships with a distributed JDBC 2.0 XA driver. Why not just use that driver instead?
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
I'm moving this to the JDBC forum. Please continue the discussion there. Thank you


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
I have UDB8.1 which comes with net (type3) driver but gives error when i try to dp distributed transaction on Weblogic 7.0 SP2
One more thing- the weblogic documentation says
"With an EJB architecture, it is common for multiple EJBs that are doing database work to be invoked as part of a single transaction. Without XA, the only way for this to work is if all transaction participants use the exact same database connection. WebLogic Server uses the JTS driver and a TxDataSource (with Emulate Two-Phase Commit for non-XA Driver selected) to do this behind the scenes without requiring you to explicitly pass the JDBC connection from EJB to EJB."
Does this mean that even if I have an non-XA driver I can still do distributed transaction if "Emulate Two-Phase Commit for non-XA Driver is selected" in weblogic
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
A "Distributed Transaction" is one that either crosses a JVM boundary or involves more than one data source (e.g. both Oracle and DB2, or DB2 and a JMS driver). What the emulation feature in Weblogic is allowing you to do is to allow mutliple EJB's to share the same connection under the covers, which keeps you from having to do a distributed transaction (e.g. by having to deal with two separate DB2 connections).
So, do you really just want to run multiple EJB's on DB2 within the same JVM, or do you have one of the other requirements of a real distributed transaction? This all depends on what you need to do...
Kyle
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
we have transaction that spans to two diff data sources and the net driver we have with DB2 doesn't support this.
whenever we open connection to the 2nd data source in the transaction we get this message
"java.sql.SQLException: Connection has already been created in this tx context for pool named <first pool's name>. Illegal attempt to create connection from another pool: <second pool's name>"
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
OK, let's back up from this a bit. What driver classname are you using? Have you tried COM.ibm.db2.jdbc.DB2XADataSource?
Kyle
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
I have tried COM.ibm.db2.jdbc.net.DB2Driver..
The XADataSource is giving configuration errors with weblogic 7.0 SP2
Gives -java.sql.SQLException: No suitable driver
[ December 16, 2003: Message edited by: Monmohan Singh ]
The exception is thrown even when the DB2java.zip ( which contains this class) is in class path
[ December 16, 2003: Message edited by: Monmohan Singh ]
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
DB2XADataSource is Type2 driver and apparaently not supported on HP UX ( the deployment platform)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Distributed Transactions