Skip to Content

JDBC lookup... ((String)rowMap.get(""))

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 02, 2008 at 04:53 PM

    If possible can you paste your lookup code here, then only we can say where you did mistake or missed something.

    Thanks

    Farooq

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Sep 02, 2008 at 05:59 PM

    Hello

    Abstract mapRow(ResultSet, int) method converts each row of the JDBC ResultSet into an object.

    thanks

    hemant

    Add comment
    10|10000 characters needed characters exceeded

    • 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