ws-kandula-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Wang <pipa...@yahoo.com>
Subject Re: MySQL's XA problem
Date Thu, 23 Feb 2006 02:45:58 GMT
--- Dasarath Weeratunge <dweeratu@purdue.edu>写道:
> Quoting Jack Wang <pipashu@yahoo.com>:
> put the client-config.wsdd in WEB-INF/classes and server-config.wsdd in WEB-INF/
> use o.a.k.coord.at.TxHandler in client-config.wsdd and o.a.k.geronimo.TxHandler 
> in server-config.wsdd
> 

Thanks. I can get the tx in service side. Now another question, :-). The update operation
did not
really update the record. The reason is at enlistResource operation. It will report error:
"java.lang.ClassCastException: org.enhydra.jdbc.standard.StandardXAConnection". It seems 
XADataSource and the tx are mismatched. How to solve this problem ?

Another question is at the end of the impl, should I close the database connection and XAResource
after sql statement ? I know I should not commit tx or tm that will be controlled by kandula.



The service side code is as
-----------------------------------
TransactionManager tm = Bridge.getInstance().getTM();
Transaction tx = tm.getTransaction();
Context ctx = new InitialContext();
//ut = (UserTransaction)ctx.lookup("java:comp/env/UserTransaction");
org.enhydra.jdbc.standard.StandardXADataSource xaDs =
ctx.lookup("java:comp/env/jdbc/myXADB20060222");
XAConnection xCon = xaDs.getXAConnection("root", "password");
java.sql.Connection conn = xCon.getConnection();
XAResource xRes = xCon.getXAResource();

try{
  tx.enlistResource(xRes);    <===== Error
}catch(Exception e){
  System.out.println("HERE, Exception " + e);
}

//ut.begin();
Statement stmt = conn.createStatement();
stmt.executeUpdate("update testdata set foo=666 where id=1");
//ut.commit();
-----------------------------------







Wang Jun


	

	
		
___________________________________________________________ 
雅虎1G免费邮箱百分百防垃圾信 
http://cn.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org


Mime
View raw message