This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Help of XA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Help of XA" Watch "Help of XA" New topic
Author

Help of XA

Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
was version: 6.0
Implementation class name of "Oracle JDBC Driver" : oracle.jdbc.xa.client.OracleXADataSource

EJB->DAO:

When running the italic lines, there are below exceptions:
DSRA9350E: Operation Connection.commit is not allowed during a global transaction.
DSRA9350E: Operation Connection.rollback is not allowed during a global transaction.

How to modify? As someone mentioned, just comment the italic lines, but how to commit or rollback db transaction?

Otherwise, why is there no problem in weblogic?


<i>Mike</i>
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9947
    
161

When you are using a XADatasource in a managed environment, the app server takes care of committing and rolling back the transactions in which this XADatasource participates. In your case the XA datasource is being used in a EJB transaction. Your application is not supposed to commit/rollback the database transaction.


[My Blog] [JavaRanch Journal]
Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
Thanks, but the same version of source codes in weblogic has no such problem, any reason?
(At least, when creating connection pool in weblogic, "Implementation class name" of "Oracle JDBC Driver" can not be set anywhere.)
Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
In weblogic, there is only such set:
"Driver Classname racle.jdbc.driver.OracleDriver".
Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
Driver Classname: oracle.jdbc.driver.OracleDriver
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9947
    
161

In that case, i guess Weblogic is not using the XA Oracle Datasource. It might be using non-XA datasource.

(At least, when creating connection pool in weblogic, "Implementation class name" of "Oracle JDBC Driver" can not be set anywhere.)


I havent worked with Weblogic, but i do think there will be some way of setting this implementation class name of the driver.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9947
    
161

In weblogic, there is only such set:
"Driver Classname: Oracle.jdbc.driver.OracleDriver".


That explains the reason why you are not seeing the error message when you are using connection.commit in the code deployed on Weblogic
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9947
    
161

Havent completely read this article, but see if its of any use to you for specifying the driver name in Weblogic:

Using third party JDBC driver in Weblogic
Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
That explains the reason why you are not seeing the error message when you are using connection.commit in the code deployed on Weblogic

In weblogic, anyway, it can run EJB->DAO well with one phase driver although don't know how...since you're familiar with was, I can only use XA and UserTransaction in EJB.

In websphere, if using one phase driver class "oracle.jdbc.pool.OracleConnectionPoolDataSource", there will be below exception:
javax.resource.ResourceException: java.sql.SQLException: enlist: caught Exception

"oracle.jdbc.driver.OracleDriver" and "oracle.jdbc.OracleDriver" (which mentioned in the weblogic link provided by you) can not be set in websphere because there is below exception when "Test connection":
Test connection failed for data source xxxx on server xxxxsvr at node xxxxnode with the following exception: java.lang.Exception: DSRA8101E: DataSource class cannot be used as one-phase: ClassCastException: oracle.jdbc.driver.OracleDriver, error code: NOT_A_1_PHASE_DS. View JVM logs for further details.

Otherwise, is there any differece between "Data sources" and "Data sources (Version 4)", I'm using "Data sources" (EJB 2.0), is it ok?
 
Don't get me started about those stupid light bulbs.
 
subject: Help of XA
 
Similar Threads
NO commit() in code, but getting "Operation Connection.commit is not allowed during a global transa"
Closing Statement object prior to committing
Need Help! - MDB transactions interacting with JDBC transactions
Operation Connection.rollback is not allowed during a global transaction.
Hibernate error