on 09-02-2008 5:03 PM
Hey all,
I'm using the JDBC lookup API but getting only nulls.
Query runs fine from SQL standard enviorment.
How does the rowMap.get() method functions?
How does it extract the requesetd data?
Pelase share from your experiance.
If possible can you paste your lookup code here, then only we can say where you did mistake or missed something.
Thanks
Farooq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the help here for the lookup API clss u r using..
http://help.sap.com/javadocs/pi/SP3/xpi/index.html
VJ
Hey all,
Problem solved.
Two failure points:
1. I have changed the casting action ((String)rowMap.get("BLA_BLA_CULOMN")) to the method toString(). got the value from the Database correctly.
2.moved on to the "real thing" to take the Sequence generated by the Oracle DB. query I was used was wrong,fixed that as well.
works like magic....
thank you all.
(gave each of you 2p, got myself a cup of coffee...)
Edited by: Nimrod Gisis on Sep 3, 2008 4:31 PM
Hello
Abstract mapRow(ResultSet, int) method converts each row of the JDBC ResultSet into an object.
thanks
hemant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Hemant,
what is the input parameters required for the get() method? Column name?
I understand the method returns and object that can be cast into string, correct?
this is strange as I'm getting null even for query that return for sure a single value...
.....
This is my source:
//write your code here
String Query = "";
Channel channel = null;
DataBaseAccessor accessor = null;
DataBaseResult resultSet = null;
// Build the Query String
Query = "SELECT SEQ_EDI_EXTRACT_ID.NEXTVAL FROM DUAL";
//QuerySingle="SELECT EDI_EXTRACT_ID FROM TW,EDI_EXTRACT WHERE EDI_EXTRACT_ID=5079815"
try{
//Determine a channel, as created in the Configuration
channel = LookupService.getChannel("sys_DEV0","JDBC_Lookup");
//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 resultset
resultSet = accessor.execute(Query);
for(Iterator rows = resultSet.getRows();rows.hasNext();)
{
Map rowMap = (Map)rows.next();
result.addValue((String)rowMap.get("EDI_EXTRACT_ID"));
}
}
catch(Exception ex){
result.addValue(ex.getMessage());
}
finally{
try{
if (accessor!=null) accessor.close();
}
catch(Exception e){
result.addValue(e.getMessage());
}
}
Edited by: Nimrod Gisis on Sep 3, 2008 8:44 AM
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.