Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reg:Error in JDBC Lookup Table

Hi All,

My actual requirement is,A project ID is being triggered to PI which will pull the data from the database(SQL Server 2000) ,from different tables and it has to post to file.Receiver side I will be using the File Adapter.

For this I am using JDBC Lookup table through an User Defined function.

// code

String Query = " ";

Channel channel = null;

DataBaseAccessor accessor = null;

DataBaseResult resultSet = null;

//Build the Query String

Query = "Select proj_id, proj_short_name from PROJECT where proj_id = '"proj_id[0]"'";

try{

channel = LookupService.getChannel("bs_test" ,"cc_test");

//Get a system accessor for the channel. As the call is being made //to an DB, an DatabaseAccessor is obtained.

accessor = LookupService.getDataBaseAccessor(channel);

//Execute Query and get the values in output

resultSet = accessor.execute(Query);

Iterator rows = null;

rows = resultSet.getRows();

while(rows.hasNext())

{

Map rowMap = (Map)rows.next();

// String proj_id = rowMap.get("proj_id");

// String project_name = rowMap.get("proj_short_name");

result.addValue((String)rowMap.get("proj_id "));

result.addValue((String)rowMap.get("project_short_name "));

//result.addValue(proj_id);

//result.addValue(project_short_name);

}

}

catch(Exception ex)

{

result.addValue(ex.getMessage());

}

finally{

try{

if (accessor!=null) accessor.close();

}

catch(Exception e)

{

result.addValue(e.getMessage());

}

//@@end

}

While testing in test tab of Message Mapping,I am getting the value as 'NULL' for the project id and am not able to see the other field.

Please suggest me in this.

Thanks in Advance,

Lavanya.B

Former Member
Not what you were looking for? View more on this topic or Ask a question