Hi,
I was using JConnect 5.2 to connect to sybase server 12.0. I was
able to commit a transaction with two phase commit. But same thing
when i tried with single phase commit it failed. Following is part of
the code,
ds = new com.sybase.jdbc2.jdbc.SybXADataSource();
ds.setDescription("Anything");
ds.setDatabaseName("test");
ds.setDataSourceName("test");
ds.setNetworkProtocol("Tds");
ds.setUser("test");
ds.setPassword("test");
ds.setServerName("test");
ds.setPortNumber(4100);
ds.setResourceManagerName("testrm");
ds.setResourceManagerType(2); // 2 for 12.x; 1 for
11.x
xacon =ds.getXAConnection();
xares = xacon.getXAResource();
xares.start(xid, XAResource.TMNOFLAGS);
java.sql.Connection con=xacon.getConnection();
Statement stmt=con.createStatement();
int i = stmt.executeUpdate("insert into test_table
values(1)");
stmt.close();
con.close();
xares.end(xid,XAResource.TMSUCCESS);
xares.commit(xid,true);
xacon.close();
I get an XAException on commit(last but one line), with error code -6
XA_ERR_PROTO.
The exact stack trace is, Note that this works absolutely fine when i use 2pc, i.e. replace last Can anyone help me? Thanks and regards,
at com.sybase.jdbc2.jdbc.SybXAResource.verifyReturnCode(SybXAResource.java:786
at com.sybase.jdbc2.jdbc.SybXAResource.sendRPC(SybXAResource.java:699)
at com.sybase.jdbc2.jdbc.SybXAResource.sendRPC(SybXAResource.java:583)
at com.sybase.jdbc2.jdbc.SybXAResource.prepare(SybXAResource.java:377)
at ConnTest.test1(ConnTest.java:65)
at ConnTest.main(ConnTest.java:535)
but one line with
xares.prepare(xid);
xares.commit(xid,false);
Bala Dutt
xares.