Bugs item #553916, was opened at 2002-05-08 16:56
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=553916&group_id=22866

Category: JBossCMP
Group: v3.0 Rabbit Hole
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: rm (tols)
Assigned to: Dain Sundstrom (dsundstrom)
Summary: DDL commands in XA transactions

Initial Comment:
Hi,

In the course of helping someone debug Tyrex with JBoss I 
came across a problem in the class 
org.jboss.ejb.plugins.jaws.jdbc.JDBCInitCommand, namely 
that a DDL operation (create table) was being executed in an XA 
transaction. The same is true of the class 
org.jboss.ejb.plugins.jaws.jdbc.JDBCDestroyCommand (drop 
table). 

This normally is not supported because there is an 
implicit commit with DDL commands. Basically a non-XA datasource 
needs to be specified for doing this.

Here are the references 
for 
Oracle:

http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a76939/adga1_xa.htm#622503

http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/appdev.901/a88876/adga1_xa.htm#622503

Riad

----------------------------------------------------------------------

>Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-06-09 10:33

Message:
Logged In: YES 
user_id=251431

DDL will no longer be executed within a transaction.  Any 
transaction will be suspended before the DDL is executed 
and resumed after.

----------------------------------------------------------------------

Comment By: rm (tols)
Date: 2002-05-14 18:51

Message:
Logged In: YES 
user_id=539346

I recall problems with the Oracle 8.1.7 drivers and Sybase 5.5 drivers 
when used in this manner, though I'm not 100% sure as it's been a while.

----------------------------------------------------------------------

Comment By: rm (tols)
Date: 2002-05-14 13:40

Message:
Logged In: YES 
user_id=539346

I recall problems with the Oracle 8.1.7 drivers and Sybase 5.5 drivers 
when used in this manner, though I'm not 100% sure as it's been a while.

----------------------------------------------------------------------

Comment By: Larry Sanderson (lsanders)
Date: 2002-05-14 13:28

Message:
Logged In: YES 
user_id=379453

Informix's most recent drivers are, though the ones from 3 -
 4 months ago are not.

----------------------------------------------------------------------

Comment By: David Jencks (d_jencks)
Date: 2002-05-14 13:08

Message:
Logged In: YES 
user_id=60525

The jca local jdbc wrapper implements similar behavior, with
LocalTransaction instead of xa resource.

I doubt the xa wrapper does the same, it needs replacing anyway.

Are the Oracle and Informix xa drivers (or any others) spec
compliant about this?

----------------------------------------------------------------------

Comment By: Larry Sanderson (lsanders)
Date: 2002-05-14 12:28

Message:
Logged In: YES 
user_id=379453

Some info from the JDBC 3.0 spec:

Participation in a distributed transaction is defined as 
the work done between
invocations of the methods XAResource.start and 
XAResource.end. Outside
these boundaries, the transaction mode is local, and a 
connection behaves exactly
like a local connection.

So, all compliant JDBC XA drivers must operate as local 
connections outside of a global tx.  

----------------------------------------------------------------------

Comment By: rm (tols)
Date: 2002-05-14 12:16

Message:
Logged In: YES 
user_id=539346

The problem is general to all databases, not just Oracle, because DDL 
commands imply an immediate implicit commit and so cannot be part of a 
transaction. The person I was helping had this problem with 
Informix.

The code begins and commits a transaction around the DDL 
call (from org.jboss.ejb.plugins.jaws.jdbc.JDBCInitCommand line 
147):

// since we use the pools, we have to do this within a 
transaction
factory.getContainer().getTransactionManager().begin();
jdbcExecute(null);
factory.getContainer().getTransactionManager().commit();

So 
you can
1) Not wrap the call in a transaction
2) Use a non-XA data 
source

I'm not familiar with the JBoss code but #1 seems like the way to 
go.

----------------------------------------------------------------------

Comment By: Dr. Christoph Georg Jung (cgjung)
Date: 2002-05-14 08:14

Message:
Logged In: YES 
user_id=175199

My experiences with the Oracle8/9 jdbc driver & XA:

Once a connection sees a distributed transaction, it will 
have two flags raised (UsingXA and ... hmmm ... 
XAThrowsError or so) which will not allow you to a) do 
any execution without a transaction associated and b) 
shortly set that connection into auto-commit mode.

If you manipulate the flags explicitely (setUsingXA, 
setXAThrows...), it is possible to do such cool things as 
raw-reads in between XA interactions. I�m not sure about 
DDL stuff, but I guess that should work too. We do that
after xa_commit, xa_rollback and xa_forget, havn�t tested 
it after xa_suspend ...
 

----------------------------------------------------------------------

Comment By: David Jencks (d_jencks)
Date: 2002-05-14 07:37

Message:
Logged In: YES 
user_id=60525

Suspending the current tx and not starting a new one would
probably work with any driver using the local wrapper, since
that executes statements outside a managed tx in autocommit
mode.  I don't know about the xa wrapper, I haven't
rewritten it yet.

----------------------------------------------------------------------

Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-05-13 23:57

Message:
Logged In: YES 
user_id=251431

So what do you want me to do about it?  Is this an Oracle 
only issue?  

I could just suspend the current transaction and not start 
a new one.  I don't really care; I'm just sick of fixing 
this code.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=553916&group_id=22866

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to