JBoss Community

Two-phase commit using an XA-datasource

created by Bohuslav Jecmen in JBoss AS 7 Development - View the full discussion

Howdy!

I'd like to ask a question about using an xa-datasource defined within my AS7 instance.

What I did: I defined two different xa-datasources pointing to two databases

What I need: I need to implement a two phase commit using those two xa-datasources mentioned above.

 

Is there any Java sample/example how to use the JBoss transactional mechanism to do what I need?

As I understood, I can (I have to) use an ordinary DataSource instead of XADataSource in my code, right? How does it work? What is the right way to do following:

1. Create two connections to 2 different DBs (using xa-datasources defined within my AS7)

2. Do some operations over both of them

3. Do a final commit (or rollback if any error)

 

Last question - what's the role of the JBoss's TransactionManager? How does it work? Is it hidden for the developers or do we need to instantiate it explicitly?

 

Since I didn't found any sufficient answer I appreciate any explanation and help!

 

Thanks a lot,

Bobo

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community