--- Dasarath Weeratunge <[EMAIL PROTECTED]>写道:
> Quoting Jack Wang <[EMAIL PROTECTED]>:
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to