db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julius Stroffek <Julius.Strof...@Sun.COM>
Subject Re: DRDA help needed
Date Fri, 11 May 2007 17:30:02 GMT
Thanks Bryan,

I tried using the IBM JCC driver but it seems that the feature is not 
implemented there. I used setDriverType method of DB2XADataSource to 
specify the driver type 4 which only seems to work to connect to derby. 
Is it possible that I am doing something wrong?

I used the following code to query the functionality 
(setTransactionTimeout should return false if the feature is not supported):
        try {
            XAConnection xaConn = 
"julo", "julo");
            XAResource xaRes = xaConn.getXAResource();

            if (xaRes.setTransactionTimeout(10)) {
                System.out.println("Supports XA transaction timeout.");
            } else {
                System.out.println("Does not support XA transaction 
            System.out.println("XA transaction timeout: " + 
        } catch (Throwable t) {

and the following code to create an XAConnection object:

    public static XAConnection createXAConnection(String dbUrl, String 
username, String password) throws Exception {
        Class dataSourceClass = 
        XADataSource dataSourceInstance = (XADataSource) 
        Class [] stringParam = new Class [] {String.class};
        dbUrl = dbUrl.substring("jdbc:derby:net://".length(), 
        String [] array1 = dbUrl.split("/");
        String [] array2 = array1[0].split(":");
        String serverName = array2[0];
        int portNumber = Integer.valueOf(array2[1]).intValue();
        String databaseOrSchemaName = array1[1];
stringParam).invoke(dataSourceInstance, new Object [] {serverName});
        dataSourceClass.getMethod("setPortNumber", new Class [] 
{int.class}).invoke(dataSourceInstance, new Object [] {portNumber});
stringParam).invoke(dataSourceInstance, new Object [] 
        dataSourceClass.getMethod("setDriverType", new Class [] 
{int.class}).invoke(dataSourceInstance, new Object [] {4});
        if (username.length() > 0)
stringParam).invoke(dataSourceInstance, new Object [] {username});
        if (password.length() > 0)
stringParam).invoke(dataSourceInstance, new Object [] {password});
        return dataSourceInstance.getXAConnection();



Bryan Pendleton wrote:
>> requires that when the function is called before any call to 
>> setTransactionTimeout it should return the default value of the 
>> resource manager. I have not found any DRDA term which can be 
>> directly used to obtain the default value from the server. 
> Is this functionality implemented in the IBM JCC driver?
> If so, you could run a test program using the JCC driver against Derby,
> and instrument your Derby server to see what DRDA traffic the JCC
> driver sends to Derby.
> thanks,
> bryan

View raw message