Skip to Content
avatar image
Former Member

Set target fileds from source fields using JDBC lookUp

hello :

advance thanks for reading below and i am new to java

how to to set the two taget fileds T1 and T2 from source field S1 using jdbc look up .Here is the code and its giving syntax error . set T1 to approver1 and T2 to approver2

I copied the code from blog 2219

How to map to two target fileds ??

Is something wrong with the query ?

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

>>>>>>>>I defined Argument a(i am passing S1) Result result

>>>Here is the code :

//write your code here

String Query = " ";

Channel channel = null;

DataBaseAccessor accessor = null;

DataBaseResult resultSet = null;

// Build the Query String

Query = "Select (approver1,approver2) from Emp where loginid = ' " + a[0] + " ' '';

try{

//Determine a channel, as created in the Configuration

channel = LookupService.getChannel("SQL99","jdbc_cc1");

//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("(approver1"));

//result.addValue((String)rowMap.get("approver2"));

}

}

catch(Exception ex){

result.addValue(ex.getMessage())

}

finally{

try{

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

}

catch(Exception e){

result.addValue(e.getMessage())

}

}

thankyou sdn:

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 19, 2009 at 05:03 AM

    what is the error?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 19, 2009 at 06:06 AM

    hi kumar,

    every statment in java should end with a semicolon... and 2 catch statments in the code given in blog(that you mentioned) are with missing semicolons at the end of the statments... just include semicolons at the end of these 2 catch staments and your code should work properly without any syntax error...

    ****************************************************

    catch(Exception ex){

    result.addValue(ex.getMessage());

    }

    finally{

    try{

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

    }

    catch(Exception e){

    result.addValue(e.getMessage());

    }

    *******************************************************

    Regards,

    JP

    Add comment
    10|10000 characters needed characters exceeded