IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  copy IData[] to Values [] for batchInsert java service

    Posted Fri June 13, 2008 02:12 AM

    Hello All,

    I am trying to write a java code which will insert multiple rows into a oracle table.
    I saw the insert sql method in wM java API-
    public Values insert(java.lang.String table,
    Values[] data,
    boolean rollbackOnFail)

    Now I have a IData array in service input, could you pls let me know how to convert this input IData array to Values array for this insert method input.

    Appreciate your help!

    Thanks,
    Joy


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 2.  RE: copy IData[] to Values [] for batchInsert java service

    Posted Fri June 13, 2008 08:02 AM

    Hello,
    Why don’t you use batchInsert built-in adapter service? Is there a particular thing you want to accomplish using a java service for this task?

    You can try this.

    1. Declare a Values object, valueObj
    2. For each IData, define a cursor.
    3. cursor.next()
    4. use cursor.getKey() and cursor.getValue() to get both name nad value;
    5. valueObj.put(key,value)
    //Here docs is an input doc list i declared
    IDataCursor cur = pipeline.getCursor();
    IData[] docs = IDataUtil.getIDataArray(cur,"List");
    Values valueObj = new Values();
    for(int i=0;i<docs.length;i++)
    {
    IDataCursor localCur = docs[i].getCursor();
    while(localCur.hasMoreData())
    {
    localCur.next();
    String key = localCur.getKey();
    String value = (String)localCur.getValue();
    valueObj.put(key,value);
    localCur.destroy();
    }
    }
    cur.destroy();

    Cheers
    Gunnasekkhaar
    http://sekkhaar.blogspot.com


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: copy IData[] to Values [] for batchInsert java service

    Posted Fri June 13, 2008 02:57 PM

    thnaks for your reply. I am trying to call different databases depending on sender id and cant change JDBC connection dynamically for 6.1 so need to write these java code.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 4.  RE: copy IData[] to Values [] for batchInsert java service

    Posted Fri June 13, 2008 05:10 PM

    I’d offer that you don’t “need” to write this in Java. Another approach would be to create the connections to the different databases and then create the JDBC services as needed for each. This probably will result in duplicate services, but IMO is a far better scenario than managing JDBC within Java. And it also sets you up for the future with 6.5 where dynamic control of the connection to use is possible.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 5.  RE: copy IData[] to Values [] for batchInsert java service

    Posted Fri June 13, 2008 05:39 PM

    we thought of that, problem is we have 3 target systems and each has 3/4 test enviroments and we need to switch very often. this is mainly require for testing, i am planning to keep adapter services in Prod.

    BTW, if anybody knows about DB2 DB url pls let me know.
    I am using these in adapter connection -
    DataSource Class- com.ibm.as400.access.AS400JDBCDataSource
    ServerName -
    user -
    password -
    Other Properties - libraries=;transaction isolation=none;prompt=false

    Thanks


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: copy IData[] to Values [] for batchInsert java service

    Posted Fri June 13, 2008 06:21 PM

    “we have 3 target systems and each has 3/4 test enviroments”

    This might be better facilitated by using multiple JDBC connections as well. It would make switching which DB a particular connection is using (test1, test2, etc.) very quick and easy.

    But clearly I don’t have all the details, so what I’m suggesting may not be effective.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB