Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resource Manager error with jConnect 6.0, WebLogic Server 8.1 sp3 and Sybase ASE 12.5.1

86 views
Skip to first unread message

torbenvesterager

unread,
Apr 5, 2005, 9:30:58 AM4/5/05
to
I can't get the jConnect 6.0 driver to work in BEA WebLogic
Server 8.1 sp3. I have tried a number of things, so my final
configuration in the weblogic config.xml looks like this:
<JDBCConnectionPool CapacityIncrement="1"
DriverName="com.sybase.jdbc3.jdbc.SybXADataSource"
InitialCapacity="1" MaxCapacity="10"
Name="ExportConnectionPool"
Password="{3DES}fBmQMcGKvmVFJzZeVh6FwQ=="

Properties="resourceManagerType=2;NetworkProtocol=Tds;DatabaseName=nesd;
BE_AS_JDBC_COMPLIANT_AS_POSSIBLE=true;FAKE_METADATA=true;resourceManagerName=exportdk;
User=nesd;PortNumber=4101;ServerName=195.41.37.111"
SupportsLocalTransaction="true" Targets="myserver"
URL="jdbc:sybase:Tds:195.41.37.111:4101/nesd"
XAEndOnlyOnce="true" XASetTransactionTimeout="true"
XATransactionTimeout="600"/>

But whatever I have tried, the following exception comes
during startup of WebLogic Server:

Unexpected exception while enlisting XAConnection
java.sql.SQLException: XA error: XAER_RMERR : A resource
manager error has occured in the
transaction branch start() failed on resource
'ExportConnectionPool': XAER_RMERR : A resource manager
error has occured in the transaction branch
javax.transaction.xa.XAException
at
com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResource.java:756)
at
com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResource.java:647)
at
com.sybase.jdbc3.jdbc.SybXAResource.start(SybXAResource.java:312)
at
weblogic.jdbc.wrapper.VendorXAResource.start(VendorXAResource.java:50)
at
weblogic.jdbc.jta.DataSource.start(DataSource.java:629)
at
weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1103)
at
weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1035)
at
weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:213)
at
weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:461)
at
weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1383)
at
weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1325)
at
weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:396)

Joe Weinstein

unread,
Apr 5, 2005, 11:36:28 AM4/5/05
to
Hi. If you can get a simple standalone program to connect,
show me it, and I'll see what needs to be done to get
weblogic to do the same.
Joe

torbenvesterager

unread,
Apr 11, 2005, 4:00:06 AM4/11/05
to
Hi Joe,

The non-XA driver seems to work fine - it connects nicely
in Eclipse's database explorer.
But it really isn't possible to make a simpler example - the
XA driver in jConnect 6.0 fails when WebLogic Server 8.1 SP3
tries to configure a JDBC connection pool during startup.
Neither the XA driver in jConnect 5.5 or WebLogic's own
Sybase XA driver fails at this point, but they have other
limitations:
jConnect 5.5 cuts varchar fields after 255 characters.
WebLogic's driver is quite slow.

Torben

Ashish Mahajan

unread,
Apr 11, 2005, 8:12:47 AM4/11/05
to
> jConnect 5.5 cuts varchar fields after 255 characters.
You can try setting JCONNECT_VERSION=6 in your connectstring to see if that
changes the behavior.

For the jConnect 6.0 issue with XA datasource, please open a case with
support.

-Ashish

<Torben Vesterager> wrote in message
news:425a2e86.522...@sybase.com...

Joe Weinstein

unread,
Apr 11, 2005, 12:52:17 PM4/11/05
to

Torben wrote:
> Hi Joe,
>
> The non-XA driver seems to work fine - it connects nicely
> in Eclipse's database explorer.
> But it really isn't possible to make a simpler example - the
> XA driver in jConnect 6.0 fails when WebLogic Server 8.1 SP3
> tries to configure a JDBC connection pool during startup.
> Neither the XA driver in jConnect 5.5 or WebLogic's own
> Sybase XA driver fails at this point, but they have other
> limitations:
> jConnect 5.5 cuts varchar fields after 255 characters.
> WebLogic's driver is quite slow.
>
> Torben

Here's a standalone program to use the sybase XA driver. Hack it with
your connection ID etc, and let me know.
joe

syb_jconnect_XAstandalone.java

torbenvesterager

unread,
Apr 12, 2005, 4:20:37 AM4/12/05
to
Hi Joe,

I made the following changes to your program:


//Properties="resourceManagerType=2;NetworkProtocol=Tds;DatabaseName=nesd;


BE_AS_JDBC_COMPLIANT_AS_POSSIBLE=true;FAKE_METADATA=true;resourceManagerName=exportdk;
User=nesd;PortNumber=4101;ServerName=195.41.37.111"

UserName = "nesd";
Password = "********";
URL = "jdbc:sybase:Tds:195.41.37.111:4101/nesd";
ServerName = "195.41.37.111";
datasourceName =
"com.sybase.jdbc3.jdbc.SybXADataSource";
PortNumber = 4101;

And it resulted in the following output:

Connection obtained with Driver version= jConnect (TM) for
JDBC(TM)/6.0(Build 25308)/P/EBF11817/JDK14/Fri Feb 27
20:57:29 2004
Driver product= Adaptive Server Enterprise/12.5/SWR 9611
GA/P/RS6000/AIX 4.3.3/main/1647/32-bit/FBO/Sat Jun 2
00:41:53 2001
Driver name= jConnect (TM) for JDBC (TM)
Driver major version= 6
Driver minor version= 0
db product name= Adaptive Server Enterprise
Got a connection
Started transaction
got data
javax.transaction.xa.XAException
at
com.sybase.jdbc3.jdbc.SybXAResource.verifyReturnCode(SybXAResource.java:850)
at
com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResource.java:763)
at
com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResource.java:647)
at
com.sybase.jdbc3.jdbc.SybXAResource.commit(SybXAResource.java:281)
at
com.sybase.jdbc3.test.XAstandalone.run(XAstandalone.java:31)
at
com.sybase.jdbc3.test.XAstandalone.main(XAstandalone.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
javax.transaction.xa.XAException
XA error code is= -6
XA error is XAER_PROTO
at
com.sybase.jdbc3.jdbc.SybXAResource.verifyReturnCode(SybXAResource.java:850)
at
com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResource.java:763)
at
com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResource.java:647)
at
com.sybase.jdbc3.jdbc.SybXAResource.commit(SybXAResource.java:281)
at
com.sybase.jdbc3.test.XAstandalone.run(XAstandalone.java:31)
at
com.sybase.jdbc3.test.XAstandalone.main(XAstandalone.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Warnings are null

Regards
Torben

torbenvesterager

unread,
Apr 12, 2005, 4:19:40 AM4/12/05
to
Hi Joe,

I made the following changes to your program:


//Properties="resourceManagerType=2;NetworkProtocol=Tds;DatabaseName=nesd;


BE_AS_JDBC_COMPLIANT_AS_POSSIBLE=true;FAKE_METADATA=true;resourceManagerName=exportdk;
User=nesd;PortNumber=4101;ServerName=195.41.37.111"

UserName = "nesd";

Regards
Torben

> Torben wrote:

> [syb_jconnect_XAstandalone.java]
>
> import java.io.*;
> import java.sql.*;
> import java.util.*;
> import javax.sql.*;
> import java.lang.reflect.Method;
> import java.sql.Connection;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.sql.DatabaseMetaData;
> import java.sql.Statement;
> import javax.sql.DataSource;
> import javax.sql.XAConnection;
> import javax.sql.XADataSource;
> import javax.transaction.xa.XAException;
> import javax.transaction.xa.XAResource;
> import javax.transaction.xa.Xid;
> import javax.transaction.TransactionManager;
> import javax.transaction.UserTransaction;
>
> public class syb_jconnect_XAstandalone {
>
> public static void run() {
> Statement stmt = null;
> Statement stmt2 = null;
>
> try
> {
> xaRes = xaConn.getXAResource();
> xid1 = TestUtil.createXid(xidBase++,1);
> xaRes.start(xid1,XAResource.TMNOFLAGS);
> System.out.println("Started transaction");
>
> conn = xaConn.getConnection();
> stmt = conn.createStatement();
> ResultSet r = stmt.executeQuery("select 1");
> r.next();
> System.out.println("got data");
> xaRes.commit(xid1, true);
> System.out.println("Committed transaction\n"
> ;);
> }
> catch (Exception e)
> {
> e.printStackTrace();
> System.out.println("XA error code is= " +
> ((XAException)e).errorCode);
> System.out.println("XA error is " +
>
> TestUtil.getXAErrStr(((XAException)e).errorCode));
> e.printStackTrace();
> try{System.out.println("Warnings are " +
> conn.getWarnings() );} catch (Exception ignore){}
> }
> finally
> {
> try{ if (stmt != null) stmt.close();
> }catch(Exception ex){}
> try{ if (stmt2 != null) stmt2.close();
> }catch(Exception ex){}
> try{ if (conn != null) conn.close();
> }catch(Exception ex){}
> }
> }
>
> // Set these below based on database driver/info
> private static String UserName;
> private static String Password;
> private static String ServerName;
> private static String datasourceName;
> private static int PortNumber;
> private static String Company;
> private static String DatabaseName;
> private static String HostName;
> private static String SID;
> private static String URL;
>
>
> private static XAResource xaRes = null;
> private static XAResource xaRes2 = null;
> private static XAConnection xaConn = null;
> private static Connection conn = null;
> private static int xidBase = 12170;
> private static Xid xid1 = null, xid2 = null;
> private static XADataSource ds = null;
>
> public static void main (String argv[]) {
>
> //Properties="user=joe
> ;url=jdbc:sybase:Tds:joe:4100/wls;networkProtocol=Tds
> ;userName=joe;portNumber=4100;databaseName=wls
> ;serverName=joe"
>
> UserName = "joe";
> Password = "joe";
> URL = "jdbc:sybase:Tds:joe:4100/wls";
> ServerName = "joe";
> datasourceName = "
> ;com.sybase.jdbc3.jdbc.SybXADataSource";
> PortNumber = 4100;
>
> try {
> // load XA driver and get connection
> ds =
> (XADataSource)(Class.forName(datasourceName).newInstance()
> );
> initProp(ds, "User", UserName);
> initProp(ds, "Password", Password);
> initProp(ds, "PortNumber", PortNumber+"
> ;");
> initProp(ds, "ServerName", ServerName);
> initProp(ds, "URL", URL);
> xaConn = ds.getXAConnection();
> conn = xaConn.getConnection();
> System.out.println("Connection obtained with
> Driver version= " +
> conn.getMetaData().getDriverVersion());
> System.out.println("Driver product= " +
> conn.getMetaData().getDatabaseProductVersion());
> System.out.println("Driver name= " +
> conn.getMetaData().getDriverName());
> System.out.println("Driver major version= "
> +
> conn.getMetaData().getDriverMajorVersion());
> System.out.println("Driver minor veresion= "
> +
> conn.getMetaData().getDriverMinorVersion());
> System.out.println("db product name= " +
> conn.getMetaData().getDatabaseProductName());
> conn.close();
> System.out.println("Got a connection");
>
> run();
> } catch (Exception e) {
> e.printStackTrace ();
> }
> }
>
> private static void initProp(Object ds, String propName,
> Object value) {
> try {
> Method[] meths = ds.getClass().getMethods();
> Method meth = null;
> String setterName = "set" + propName;
> Class paramType = null;
> for (int i = 0; i < meths.length; i++) {
> if
> (meths[i].getName().equalsIgnoreCase(setterName) &&
> meths[i].getParameterTypes().length == 1) {
> meth = meths[i];
> paramType = (meths[i].getParameterTypes())[0];
> break;
> }
> }
> if (meth != null) {
> Object val = value;
> if (value instanceof String) {
> if (paramType == int.class) {
> val = Integer.valueOf((String)value);
> } else if (paramType == boolean.class) {
> val = Boolean.valueOf((String)value);
> }
> }
> meth.invoke(ds, new Object[]{val});
> } else {
> meth = ds.getClass().getMethod(
> "setProperty", new Class[]{String.class,
> Object.class});
> meth.invoke(ds, new Object[]{propName, value});
> }
> } catch (Exception ignore) { }
> }
> }
>
> class TestUtil {
> static Object xaLock = new Object();
>
> public TestUtil() {}
>
> public static void println(String msg) {
> System.out.println(msg);
> }
>
> public static void dumpXAError(Exception xae) {
> System.out.println("err msg: " +
> xae.getMessage());
> xae.printStackTrace();
> }
>
> public static Xid createXid(int gd, int bd)
> throws XAException
> {
> byte[] gid = new byte[1]; gid[0]= (byte) gd;
> byte[] bid = new byte[1]; bid[0]= (byte) bd;
> byte[] gtrid = new byte[64];
> byte[] bqual = new byte[64];
> System.arraycopy (gid, 0, gtrid, 0, 1);
> System.arraycopy (bid, 0, bqual, 0, 1);
> Xid xid = new XidImpl(0x1, gtrid, bqual);
> return xid;
> }
>
> public static String getXAErrStr(int err) {
> switch (err) {
> case XAException.XA_RBROLLBACK:
> return "XA_RBROLLBACK";
> case XAException.XA_RBCOMMFAIL:
> return "XA_RBCOMMFAIL";
> case XAException.XA_RBDEADLOCK:
> return "XA_RBDEADLOCK";
> case XAException.XA_RBINTEGRITY:
> return "XA_RBINTEGRITY";
> case XAException.XA_RBOTHER:
> return "XA_RBOTHER";
> case XAException.XA_RBPROTO:
> return "XA_RBPROTO";
> case XAException.XA_RBTIMEOUT:
> return "XA_RBTIMEOUT";
> case XAException.XA_RBTRANSIENT:
> return "XA_RBTRANSIENT";
> case XAException.XA_NOMIGRATE:
> return "XA_NOMIGRATE";
> case XAException.XA_HEURHAZ:
> return "XA_HEURHAZ";
> case XAException.XA_HEURCOM:
> return "XA_HEURCOM";
> case XAException.XA_HEURRB:
> return "XA_HEURRB";
> case XAException.XA_HEURMIX:
> return "XA_HEURMIX";
> case XAException.XA_RETRY:
> return "XA_RETRY";
> case XAException.XA_RDONLY:
> return "XA_RDONLY";
> case XAException.XAER_ASYNC:
> return "XAER_ASYNC";
> case XAException.XAER_RMERR:
> return "XAER_RMERR";
> case XAException.XAER_NOTA:
> return "XAER_NOTA";
> case XAException.XAER_INVAL:
> return "XAER_INVAL";
> case XAException.XAER_PROTO:
> return "XAER_PROTO";
> case XAException.XAER_RMFAIL:
> return "XAER_RMFAIL";
> case XAException.XAER_DUPID:
> return "XAER_DUPID";
> case XAException.XAER_OUTSIDE:
> return "XAER_OUTSIDE";
> default:
> return (new Integer(err)).toString();
> }
> }
> }
>
> class XidImpl implements Xid
> {
> public int formatId;
> public byte[] gtrid;
> public byte[] bqual;
>
> public byte[] getGlobalTransactionId() {return gtrid; }
> public byte[] getBranchQualifier() {return bqual; }
> public int getFormatId() {return formatId;
> }
>
> XidImpl(int formatId, byte[] gtrid, byte[] bqual)
> {
> this.formatId = formatId;
> this.gtrid = gtrid;
> this.bqual = bqual;
> }
> private static char DIGITS[] = { '0','1','2','3','4'
> ,'5','6','7','8',
> '9','A','B','C','D','E','F'};
>
> public String toString() {
> return toString(this);
> }
>
> public static String toString(Xid xid) {
> StringBuffer sb = new StringBuffer()
>
> .append(Integer.toHexString(xid.getFormatId()).toUpperCase
> ()).append("-")
>
> .append(byteArrayToString(xid.getGlobalTransactionId()));
> String bqual =
> byteArrayToString(xid.getBranchQualifier());
> if (!bqual.equals("")) {
> sb.append("-"
> ;).append(byteArrayToString(xid.getBranchQualifier()));
> }
> return sb.toString();
> }
> private static String byteArrayToString(byte[] barray)
> {
> if (barray == null) return "";
> StringBuffer buf = new StringBuffer();
> for (int i = 0; i < barray.length; i++) {
> buf.append(DIGITS[(barray[i] & 0xF0) >>>
> 4]);
> buf.append(DIGITS[barray[i] & 0x0F]);
> }
> return buf.toString();
> }
> }
>
> [Attachment: syb_jconnect_XAstandalone.java]

torbenvesterager

unread,
Apr 12, 2005, 4:18:40 AM4/12/05
to
Hi Joe,

I made the following changes to your program:


//Properties="resourceManagerType=2;NetworkProtocol=Tds;DatabaseName=nesd;


BE_AS_JDBC_COMPLIANT_AS_POSSIBLE=true;FAKE_METADATA=true;resourceManagerName=exportdk;
User=nesd;PortNumber=4101;ServerName=195.41.37.111"

UserName = "nesd";

Regards
Torben

> Torben wrote:

> >>com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResourc
> e. >>
> >>> java:756) at
> >>>
> >>
> >>com.sybase.jdbc3.jdbc.SybXAResource.sendRPC(SybXAResourc
> e. >>
> >>> java:647) at
> >>>
> >>
> >>com.sybase.jdbc3.jdbc.SybXAResource.start(SybXAResource.
> ja >>
> >>> va:312) at
> >>>
> >>
> >>weblogic.jdbc.wrapper.VendorXAResource.start(VendorXARes
> ou >>

> >>> rce.java:50) at
> >>>weblogic.jdbc.jta.DataSource.start(DataSource.java:629)
> >>> at
> >>>
> >>

Joe Weinstein

unread,
Apr 12, 2005, 11:08:56 AM4/12/05
to
Good enough. Now you have a standalone that Sybase should take as a reproducer for
a bug in their XA driver. If you don't have a Sybase support contract, send the
program back to me, and I'll enter it. Do you need the fake metadata setting?
Joe
0 new messages