Hi.I have same requirement and i have done the same but its showing as null in the output.Below is my code.
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
Connection c  = null;
ResultSet  rs = null;
Statement  s  = null;
String sqlString = null;
int rowCount = 0;
String statusCode = “0”;
String statusMsg = “”;
ArrayList list = new ArrayList();
//List list = new List();
try {
IData inRec = IDataUtil.getIData( pipelineCursor, "inRec" );
String    WhereCondition = IDataUtil.getString( pipelineCursor, "WhereCondition" );
String    Table = IDataUtil.getString( pipelineCursor, "Table" );
if ( inRec == null) throw new Exception ("inRec record is empty.");
String  errString = "";
boolean errCode   = false; 
if (WhereCondition == null) {
errString += (errCode) ? ", WhereCondition" : "WhereCondition" ;
errCode = true;
}
if (Table == null) {
errString += (errCode) ? ", Table" : "Table" ;
errCode = true;
}
if ( errCode ) throw new Exception(errString + " Field(s) are empty");
pipelineCursor.destroy();
IDataCursor inRecCursor = inRec.getCursor();
// get columns
int n = IDataUtil.size(inRecCursor);
String[] colNames = new String[n];
inRecCursor.first();
for( int j=0; j<n; j++ )
{
colNames[j] = inRecCursor.getKey();
inRecCursor.next() ;
}
String selectList = "";
int colCount = colNames.length;
for (int i=0; i<colNames.length; i++) {
selectList += colNames[i];
if ((i+1) != colNames.length) {
selectList += ", ";
}        
}
inRecCursor.destroy();
// DBrec
IData    DBrec    = IDataUtil.getIData( pipelineCursor, "DBrec" );
String  dbUrl    = "";
String  user     = "";
String  password = "";
String  DBClass  = "";
if ( DBrec != null)
{
IDataCursor DBrecCursor = DBrec.getCursor();
dbUrl    = IDataUtil.getString( DBrecCursor, "DbUrl" );
user     = IDataUtil.getString( DBrecCursor, "User" );
password = IDataUtil.getString( DBrecCursor, "Pwd" );
DBClass  = IDataUtil.getString( DBrecCursor, "DBClass" );
DBrecCursor.destroy();
}
else {
dbUrl    = getParameter("dbURLSOM", "SpGeneralUtil");
user     = getParameter("dbUserSOM", "SpGeneralUtil");
password = getParameter("dbPassSOM", "SpGeneralUtil");
DBClass  = getParameter("dbDriver", "SpGeneralUtil");
}
// Establish DB connection
Class.forName( DBClass );
c = DriverManager.getConnection(dbUrl, user, password);
s = c.createStatement();
// Create output IData object
IData resultList = new IData[1000];
IData    resultList1 = IDataFactory.create();
// Prepare SQL Statement
sqlString = "SELECT " + selectList + " " +
"FROM " + Table + "  " +
"WHERE " + WhereCondition + " ";
rs = s.executeQuery(sqlString);    
int j=0;
while (rs.next() )
{
IDataCursor idcpipelineCursor = resultList[j].getCursor();
for (int i=0; i<colCount; i++) {
String columnName = rs.getString(colNames[i]);
idcpipelineCursor.setKey(columnName);
String columnValue = rs.getString(i); 
idcpipelineCursor.setValue(columnValue);
idcpipelineCursor.next();
IDataUtil.put( pipelineCursor, "resultList",  resultList);
}
j++;
idcpipelineCursor.destroy();
}// while(rs.next()) 
if (rowCount <= 0) {
statusMsg =" No rows fetched for the SQL statement : " + sqlString ;
statusCode= "1";
c.close(); 
}
if (rs != null)    rs.close();
if (s != null) s.close(); 
if (c != null) c.close(); 
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, "outRec", resultList1 );
IDataUtil.put( pipelineCursor_1, "StatusCode", statusCode );
IDataUtil.put( pipelineCursor_1, "StatusMsg", statusMsg );
//outRecCursor.destroy();
pipelineCursor_1.destroy();
}
catch (Exception e) {
try {
if (rs != null)    rs.close();
if (s != null) s.close();
if (c != null) c.close();
}
catch (SQLException f) {
}
IDataCursor pipelineCursor_e = pipeline.getCursor();
IDataUtil.put(pipelineCursor_e, “StatusCode”, “1”);
IDataUtil.put(pipelineCursor_e, “StatusMsg”, "DatabaseUtil:getInfoFromDataBases  exception : " + e.getMessage() + ".    SQL Statement : " + sqlString );
pipelineCursor_e.destroy();
}
Please do the changes in my code where is the mistake done as i am new to webMethods developer.
Thanks in advance…
#Integration-Server-and-ESB#webMethods#Flow-and-Java-services