GeeCON Prague 2014*
The moose likes Websphere and the fly likes How to use  MS SQL and DB2 in the same transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Websphere
Bookmark "How to use  MS SQL and DB2 in the same transaction " Watch "How to use  MS SQL and DB2 in the same transaction " New topic
Author

How to use MS SQL and DB2 in the same transaction

Bala RThiagarajan
Greenhorn

Joined: Dec 21, 2007
Posts: 8
I am using both MS SQL and DB2 in the same transaction can any one tell how to create the Datasource object for this scenario in WSAD

[ January 28, 2008: Message edited by: Bala RThiagarajan ]
[ January 28, 2008: Message edited by: Bala RThiagarajan ]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

You might want to look at Hibernate Shards. That is designed to assist in developing applications that go to multiple databases.

-Cameron McKenzie
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

You will need to create two DataSource with XA support. ( your driver should support XA and for SQL server you need to perform some manual steps like installing stored procedure)

You will need to begin a UserTrasaction including two connections one from SQL server datasource and the other from DB2 Datasource, Connections autoCommit should be false.
After you execute all statement on those two connection you can commit UserTransaction, this will commit DB2 and SQL Server connections' statement in a two phase manner.


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
 
GeeCON Prague 2014
 
subject: How to use MS SQL and DB2 in the same transaction