Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

2PC - with DB2 8.2 instances from WebSphere

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to do 2 phase commit between 2 different DB2 8.2 databases from a servlet based application deployed in WebSphere 5.1.x.

My code is like:

UserTransaction tx = (UserTransaction) ServerConnector.getContext().lookup("java:comp/UserTransaction");
tx.begin();
try{
insertIntoDatabase1(conn); // should throw exception on failure
insertIntoDatabase2(conn); // should throw exception on failure
tx.commit();
}catch(Exception e){
tx.rollback();
}finally{
connectionClose();
statementsClose();
}

insertIntoDatabase1(conn) and insertIntoDatabase2(conn) do NOT thow any exception, meaning the succeed.

However, the line tx.commit() throws the exception below.

I get the exception below:

[5/3/06 14:50:13:708 EDT] 371526c1 XATransaction E J2CA0027E: An exception occurred while invok
ing prepare on an XA Resource Adapter from dataSource dtpra, within transaction ID {XID: format
Id(57415344), gtrid_length(38), bqual_length(28), data(000000000000000200000001322f8fcc37bacf22
ead70b086b31235fe71fa6f46f6473706f63322f8fcc37bacf22ead70b086b31235fe71fa6f400000001d866bc79)}:
javax.transaction.xa.XAException
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!