Home » Developer & Programmer » JDeveloper, Java & XML » Usage of oracle XA interface with JDBC
Usage of oracle XA interface with JDBC [message #91451] Wed, 11 September 2002 05:10 Go to next message
Matthias Geiss
Messages: 1
Registered: September 2002
Junior Member
Hello,

I want to use the oracle xa interface through the JDBC API.
The normal usage of the methods start, end, prepare, commit / rollback works fine.
However after a (simulated) application failure I want recover prepared database transactions and than call commit or rollback.

Therefor I use the XAResource recover method first to get the Xids of the prepared database transactions. This works fine. Afterwards I call the XAResource commit or rollback method with one of the recovered Xids and this call fails (see below). I am using the Oracle 8.1.7 jdbc:oracle:thin: driver and connect to a Oracle 8.1.6 server.

This is what I do:

1. A java application creates the OracleXADataSource, and from this an
XAConnection, a Connection and an XAResource.
With a created xid, the xa transaction is started, some work is done through the Connection instance, the xa transaction is ended and successfully prepared.
Then I close all connections and end the application.

I find a new entry in the view SYS.DBA_PENDING_TRANSACTIONS.

2. The application starts again and creates an OracleXADataSource, an XAConnection, a Connection and an XAResource. This time I use the recover method to get the recoverable xids and pick the first one to recover.

Xid [[]] rec_xids = oxar1.recover(XAResource.TMNOFLAGS);
Xid xid = rec_xids[[0]];

oxar1.rollback(xid);
//oxar1.commit(xid, false);

In both cases - rollback or commit - the following exception is thrown:

java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException
ORA-06512: at "SYS.JAVA_XA", line 0
ORA-06512: at line 1

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:407)
at oracle.jdbc.xa.client.OracleXAResource.commit(OracleXAResource.java:344)
at XARecover.main(XARecover.java:149)

Has anyone done something similar successfully?
Does the 8.1.6 server support committing or rolling back prepared transactions through JDBC?
Any other comments or tips are wellcome.

Thanks,
Matthias
Re: Usage of oracle XA interface with JDBC [message #91829 is a reply to message #91451] Fri, 14 March 2003 08:53 Go to previous message
Akhilesh Kumar
Messages: 1
Registered: March 2003
Junior Member
I am facing same problem..... If anybaody can help us....
Previous Topic: execute oracle report (RDF) from java code
Next Topic: SSL Implementation Not Available
Goto Forum:
  


Current Time: Fri Apr 19 06:21:11 CDT 2024