cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC LookUp is not working

former_member322289
Participant
0 Kudos

Hi All,

This is my scenario...

SAP - IDOC(WINVE03 - Inventory) to MS-SqlServer 2000.

I followed this blog:

/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

which help me a lot....

but.. when test the interfase it shows a null...

the resultSet.getRows() is empty... so the "for" is never executed.

the communication channel Monitoring says this.

Success Receiver JDBC adapter: processing started; QoS required: BestEffort

Success JDBC adapter receiver channel svr_Dgmo_pilog0205_jdbc_client2: processing started; party , service SERVICE_OF_TEST

Success Database request processed successfully

channel is ok... the database has data...

regards.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

check the query if possible? try to run the query on db and see if any results returned.

former_member322289
Participant
0 Kudos

I have tryed with this querys:

- select id from ilog_0205 order by id asc

- exec ilog_0205_select_id

both in MS-SQL return data... but nothing in PI

Former Member
0 Kudos

Are you sure that the "for" loop is never executed ? Maybe you could add some piece of debug code in order to see what happens exactly (using the XI debug message framework in mappings), like :

for(Iterator rows = resultSet.getRows();rows.hasNext();){

HERE, add a print debug message so you know where for gets executed

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

HERE, add a print debug message to get the return value from (String)rowMap.get("URole")

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

}

According to lookup API specs, if rowMap.get("URole") contains a SQL NULL value, a null java object will be returned, so the (String) cast would return "null" in this case ...

Rgds

Chris

former_member322289
Participant
0 Kudos

Hi,

well, i think have found the problem...

result.addValue((String)rowMap.get("id")); trigger a exception(ex)......

so... put the exception in the result and it gave me a NULL... something like this...

result.addValue("EX" + ex);

and result is EXnull...

that means than my query doesn't return a valid row from the SQL... why??? if it has data???????? and the query is ok (execute this on the data base and works)...

Regards and Thanks.

Former Member
0 Kudos

Hi Guillermo,

Please verify all your connection details... verify that in the UDF you are referencing the rigth Comm Channel, rigth DB table.

Also Verify that you have created the rigth configuration objects in the integration Directory.

Regards,

Felipe

former_member322289
Participant
0 Kudos

mmm may be this could help us...

in SQL server... the field ID is PK, type numeric, and autoincrement...

the return of lookup says ... "java.lang.ClassCastException"...

but if I change this field by "LOTE" it bring to me the value correctly...

it looks good for now.

result.addValue((String)rowMap.get("id")) => java.lang.ClassCastException

result.addValue((String)rowMap.get("lote")) => ok

Regards

former_member322289
Participant
0 Kudos

is done...

the problem is than java can not interpretate my numeric... and convert it to string...

so... I have done this:

String test = "";

.

.

.

.

result.addValue(test + rowMap.get("id"));

.

.

.

.

and works

Regards all

Former Member
0 Kudos

> String test = "";

> result.addValue(test + rowMap.get("id"));

you don't need to declare a variable for that..

result.addValue("" + rowMap.get("id")); or using String.valueOf( rowMap.get("id") );