--- Dasarath Weeratunge <[EMAIL PROTECTED]>写道:
> keep on forgetting to send replies to the list...
> >     
> > The java code (JOTM example):
> > ========================================================
> > UserTransaction ut = null;
> > try{
> >     Context ctx = new InitialContext();
> >     MysqlXADataSource xaDs =
> > (MysqlXADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
> >     ut = (UserTransaction)ctx.lookup("java:comp/env/UserTransaction");
> 
> How did u obtain this UserTransaction Object? It should come from the 
> Geronimo 
> TM object instantiated by Bridge.
> 
> > 
> >     XAConnection xCon = xaDs.getXAConnection();
> 
> I don't see u enlisting this XAResource in your local tx object...
> 
> >     java.sql.Connection conn = xCon.getConnection();
> > 
> >     System.out.println("<<< beginning the transaction >>> xa con = " +
> > conn);
> >     ut.begin();
> > 
> >     // JDBC statements
> >     Statement stmt = conn.createStatement();
> >     ResultSet rst =  stmt.executeQuery("select id, foo from testdata");
> >     if(rst.next()) {
> >         foo=rst.getInt(2);
> >     }
> >     System.out.println("foo = "+ foo +" (before completion)");
> > 
> >     String sql = "update testdata set foo=" + (++foo) + " where id=1";
> >     stmt.executeUpdate(sql);// <=== The program will wait here, and then
> > report the error message
> > !
> >     
> >     ut.commit();
> >     System.out.println("<<< committing the transaction >>>");
> 
> 
> Here we go once again. Please don't commit the tx in your code. The tx will 
> be 
> started and commited when you terminate your distributed (ws-at) tx using 
> wa-at 
> Completion protocol. If you want to rollback your tx, you may do so however. 
> Even then it is better to mark the tx as "RollbackOnly".
> 
> I will give u some steps later on.


Thanks Dasarath. This is not the ws, so I add the commit method to test the db 
operation. The
result is that the operation is failed. I only use it to test MySQL's XA. It 
seems I can not drive
MySQL to use it's XA. If the situation is indeed this, I will have no database 
server to use in
the kandula's experimentation.

> 
> --dasarath


Wang Jun

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to