Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

Getting error message in UDF

$
0
0

Hi All,

 

I have a requirement to perform the JDBC Lookup. I have to fetch the record from the Lookup Table to check the condition to retrieve the field from the Lookup Table. I used standard JDBC Lookup, there is no provision to configure the WHERE Clause of MySQL statement.

 

So that I wrote the UDF in SAP PI 7.11 to call the DB Lookup. But still am getting an error. Please suggest me how to resolve this.

 

UDF Code

String Query = " ";

Channel channel = null;

DataBaseAccessor accessor = null;

DataBaseResult resultSet = null;

 

// Build the Query

 

String Query = "Select SCCode from ControlDB_Views.Agency_IATA_SCCode_Master where SCCode IS NOT NULL AND GDS_Nbr GT 1 AND (Effective_Date LE Booking_date AND Discontinue_Date GT Booking_Date),";

 

try

{

 

//Determine a channel, as created in the Configuration

channel = LookupService.getChannel("TDWARC_D ","JDBC_r_BOIM_EMERGO_2_SGFTP_2_SEP_M_MIDT_JDBC_LKUP_TDWARC ");

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

  1. result.addValue((String)rowMap.get("SCCode"));

}

 

}

catch(Exception ex)

{

  1. result.addValue(ex.getMessage());

}

finally{

 

if (accessor!=null) {

  1. accessor.close();

}

}

try{

  1. accessor.close();

}

catch(Exception e)

{

  1. result.addValue(e.getMessage());

}

 

ERROR Message

 

 

  • Function DBLOOKUP, Line 8:

Query is already defined in DBLOOKUP(java.lang.String[],java.lang.String[],java.lang.String[],com.sap.aii.mappingtool.tf7.rt.ResultList,com.sap.aii.mappingtool.tf7.rt.Container)
String Query = "Select SCCode from ControlDB_Views.Agency_IATA_SCCode_Master where SCCode IS NOT NULL AND GDS_Nbr GT 1 AND (Effective_Date LE Booking_date AND Discontinue_Date GT Booking_Date),";
^
Note: /usr/sap/SXD/DVEBMGS02/j2ee/cluster/server1/./temp/classpath_resolver/Map23e678060adf11e38f5b000001b11a6b/source/com/sap/xi/tf/_mm_BOIM_EMERGO_2_SGFTP_2_SEP_M_MIDT_JDBC_LKUP_TDWARC_ramesh_UDF_.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /usr/sap/SXD/DVEBMGS02/j2ee/cluster/server1/./temp/classpath_resolver/Map23e678060adf11e38f5b000001b11a6b/source/com/sap/xi/tf/_mm_BOIM_EMERGO_2_SGFTP_2_SEP_M_MIDT_JDBC_LKUP_TDWARC_ramesh_UDF_.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>