copy IData[] to Values [] for batchInsert java service

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!


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.
  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();
 String key = localCur.getKey();
 String value = (String)localCur.getValue();


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.

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.

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-
ServerName -
user -
password -
Other Properties - libraries=;transaction isolation=none;prompt=false


“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.