| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Problems using JTA
Hi,
I am trying to make Oracle's sample code with distributed transactions
in java. When I try to do the update in the second database executions
stops. No exceptions, the program just stops executing. Can anybody
tell me what I am doing wrong?
/Fredrik
String url_palloadm =
"jdbc:oracle:thin:palloadm/xxxx_at_sun2:1521:dev";
String url_test470_ora =
"jdbc:oracle:thin:test470_ora/xxxx_at_sun2:1521:dev";
oracle.jdbc.xa.client.OracleXADataSource ds_palloadm = new oracle.jdbc.xa.client.OracleXADataSource();
ds_palloadm.setURL(url_palloadm);
oracle.jdbc.xa.client.OracleXADataSource ds_test470_ora = new
oracle.jdbc.xa.client.OracleXADataSource();
ds_test470_ora.setURL(url_test470_ora);
Xid xid_palloadm = createXid(1);
Xid xid_test470_ora = createXid(2);
XAConnection xaconn_palloadm = ds_palloadm.getXAConnection();
XAResource resource_palloadm =
xaconn_palloadm.getXAResource();
resource_palloadm.start(xid_palloadm, XAResource.TMNOFLAGS);
Connection conn_palloadm = ds_palloadm.getConnection();
conn_palloadm.setAutoCommit(false);
XAConnection xaconn_test470_ora =
ds_test470_ora.getXAConnection();
XAResource resource_test470_ora =
xaconn_test470_ora.getXAResource();
resource_test470_ora.start(xid_test470_ora,
XAResource.TMNOFLAGS);
Connection conn_test470_ora = ds_test470_ora.getConnection();
conn_test470_ora.setAutoCommit(false);
Statement statement_test470_ora =
conn_test470_ora.createStatement();
statement_test470_ora.executeUpdate("insert into berlog_temp
values('kalle', '36', 'hej', 'xxx')");
statement_test470_ora.close();
Statement statement_palloadm =
==> Executions stops here!!!!!
statement_palloadm.executeUpdate("insert into berlog_temp values('kalle', '36', 'hej', 'xxx')");
statement_palloadm.close();
resource_palloadm.end(xid_palloadm, XAResource.TMSUCCESS);
resource_test470_ora.end(xid_test470_ora,
XAResource.TMSUCCESS);
int ret_palloadm = resource_palloadm.prepare(xid_palloadm);
int ret_test470_ora =
if (ret_palloadm == XAResource.XA_OK)
resource_palloadm.commit(xid_palloadm, false);
else
System.out.println("No commit palloadm");
if (ret_test470_ora == XAResource.XA_OK)
resource_test470_ora.commit(xid_test470_ora, false);
else
System.out.println("No commit test470_ora");
Received on Wed Sep 03 2003 - 07:16:53 CDT
![]() |
![]() |