Changing JDBC connection for existing Services

Hi There,

I’m working on an integration that I inherited from someone that makes heavy use of the JDBC adapter. The developer chose a non standard name for the connection, and chose to put it in the wrong package - so I basically need a new connection.

However - there are already a heap of adapter services that have been defined and it will take some time to recreate them all.

I looked through the .ndf files in the ns directory for the package hoping that the connection name would be somewhere in the XML and I could change it there… alas no - so I suspect it is held in the IRTNODE_PROPERTY which is not human readable.

Has anyone worked out a way to do this?

Steve

Renaming seems to be nearly impossible without creating all the adapters again. But you can move the connections to a different package as long as you keep exactly the same namespace.

Thanks Patrick

I figured this was the case. I ended up recreating them all in the end…

It’s for stupid things like this - that I really loath working with webMethods sometimes…

Steve

Hi,

I know that it is a very late reply to this one.

[url=“{Khapre.org}”]{Khapre.org}

Check this out.

Hi,

I know that it is a very late reply to this one.

[url=“{Khapre.org}”]{Khapre.org}

Check this out.

Changed adderess to this site
[url=“{Khapre.org}”]{Khapre.org}

Hi Chirag,
I am trying to decode the information in the IRTNODE_PROPERTY of a SELECT JDBC ADAPTER SERVICE.The node.ndf I’m trying to decode is attached.Going by the suggested solution to decode the same, I wrote the test java program below.

But still I dont see any information in the output.
Can you suggest how to decode/de-serialize the info in the IRTNODE_PROPERTY.

Thanks,
-Sid

import com.wm.util.coder.XMLCoder;
import com.wm.util.;
import java.io.
;
public class DecodeAdapterInfo {
public static void main(String a){
try {
System.out.println(“Start–”);
FileInputStream istream = new FileInputStream(“C:\TEMP\ns\GE_OFS_JDBC_Adapter_Services\OFS_ServicesQuoteOrder_Source\GEPS_CS_FS_GC_INRS_HDR_STG_SelectSQL\node.ndf”);
XMLCoder coder = new XMLCoder ();
Values values = new Values();
values = coder.decode(istream);
java.util.Enumeration enum = values.sortedKeys();
while(enum.hasMoreElements()){
String JDBCInfo = (String)enum.nextElement();
String JDBCValue = values.getString(“IRTNODE_PROPERTY”);
System.out.println(JDBCInfo+“—”+JDBCValue);
}
String JDBCInfo = values.toString();
System.out.println(JDBCInfo);
System.out.println(“–End”);
} catch(Exception e){
e.printStackTrace();
}
}
}

Use pub.art.service:setAdapterServiceNodeConnection … Changes the connection used by a given adapter service.

hi, i managed to enable/disable jdbc adapters with IS shutted down, here is the java :

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import com.wm.util.Base64;
import com.wm.data.IData;
import com.wm.data.IDataCursor;
import com.wm.data.IDataUtil;
import com.wm.util.Values;
import com.wm.util.coder.*;

public class changeJDBCStatut {

  public static String iDataNodePropertiesToString(IData data)
  {
    ByteArrayOutputStream bos = null;
    try {
      IDataBinCoder coder = new IDataBinCoder();
      bos = new ByteArrayOutputStream(1024);
      coder.encode(bos, data);
      String s = new String(Base64.encode(bos.toByteArray(), false), "UTF8");

      String str1 = s;
      return str1;
    }
    catch (Throwable tt)
    {
    }
    finally
    {
      if (bos != null) {
        try { bos.close(); } catch (Throwable tt) {
        }
        bos = null;
      }
    }
    return null;
  }


public static IData stringToIDataNodeProperties(String encodedData) {
        ByteArrayInputStream bis = null;
        try {
          IDataBinCoder coder = new IDataBinCoder();
          bis = new ByteArrayInputStream(Base64.decode(encodedData.getBytes("UTF8")));
          IData localIData = coder.decode(bis);
          return localIData;
        }
        catch (Throwable tt)
        {
        }
        finally
        {
          if (bis != null) {
            try { bis.close(); } catch (Throwable tt) {
            }
            bis = null;
          }
        }
        return null;
}



  protected static Values iDataToValues(IData i)
  {
    if (i.getClass() == Values.class) {
      return (Values)i;
    }
    Values v = new Values();
    IDataUtil.copy(i, v);
    return v;
  }



public static void main(String argv[]) {
    
    if(argv.length != 2)
    {
        System.out.println("Le nombre d'arguments donnees n'est pas bon.\nAttendu : 2\nTrouve :" + argv.length);
        System.exit(1);
    }
    // On va affecter les paramètres par défaut
    String leFichier=argv[0];
    String statut=argv[1];

      try {
 
        //File fXmlFile = new File("E:\\DONNEES\MES_DOCUMENTS\\JPE\\PARTAGE\\node.ndf");
        File fXmlFile = new File(leFichier);
        InputStream essaiInput = new FileInputStream(fXmlFile);
        XMLCoder xmlCoderClass2 = new XMLCoder();
        Values essaiValues = xmlCoderClass2.decode(essaiInput);

        String objTest = (String)essaiValues.getValue("IRTNODE_PROPERTY");
        
        IData essaiData = stringToIDataNodeProperties(objTest);
        
        IDataCursor cursor = essaiData.getCursor();
        while(cursor.hasMoreData()) {
            //System.out.println("\n");
            //System.out.println(cursor.getKey());
            //System.out.println("\n");
            if(cursor.getKey()!=null) {
                if(cursor.getKey().equals("connectionEnabled")){
                    //cursor.setValue("false");
                    cursor.setValue(statut);
                }
            }
            cursor.next();
        }
        
        String objTestOut = iDataNodePropertiesToString(essaiData);
        cursor.destroy();
        essaiValues.setValue("IRTNODE_PROPERTY", objTestOut);
        
        OutputStream essaiOutPut = new FileOutputStream(fXmlFile);
        xmlCoderClass2.encode(essaiOutPut, essaiValues);
        
      } catch (Exception e) {
        e.printStackTrace();
      }
      System.exit(0);
      
  }

julien PHILIPPE, ATOS france.