Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help of XA

 
Mike Sever
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mike Sever
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In weblogic, there is only such set:
"Driver Classname racle.jdbc.driver.OracleDriver".
 
Mike Sever
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Driver Classname: oracle.jdbc.driver.OracleDriver
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic