cancel
Showing results for 
Search instead for 
Did you mean: 

Error in User defined function for jdbc lookup

Former Member
0 Kudos

I am getting th error as follows "Method TestJDBCAPI$ with 2 arguments not found in class com.sap.xi.tf._JLU_MM_" when i a m testing in message mapping

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I modified the code.Now i'm getting the following error.

Source code has syntax error: D:/usr/sap/AXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapff08d880133011dc968800163500db18/source/com/sap/xi/tf/_JLU_MM_.java:54: '.class' expected Query = "Select role from login where username = " + username[] + " and password = " + password[] ; ^ 1 error Source code has syntax error: D:/usr/sap/AXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapff08d880133011dc968800163500db18/source/com/sap/xi/tf/_JLU_MM_.java:54: '.class' expected Query = "Select role from login where username = " + username[] + " and password = " + password[] ; ^ 1 error

bhavesh_kantilal
Active Contributor
0 Kudos

Select role from login where username = " + username[] + " and password = " + password[]

You still have brackets. The query should be,

Select role from login where username = " + username + " and password = " + password

regards

Bhavesh

Answers (5)

Answers (5)

Former Member
0 Kudos

Its working now.May i know the reason why should it be changed like that?

Former Member
0 Kudos

I have multiple records in my database.I thought it should be passed like an array.Correct me if i'm wrog

Former Member
0 Kudos

Hi,

My import parameters are username and password.Its not an advanced UDF.I'm trying out the example JDBC lookup given in blogs.

bhavesh_kantilal
Active Contributor
0 Kudos

In that case, change the select Query in your code from,

>Query = "Select role from login where username = " + username[0] + " and password = " + password[0] ;

to

>Query = "Select role from login where username = " + username + " and password = " + password ;

Regards

Bhavesh

Former Member
0 Kudos

//write your code here

String Query = " ";

Channel channel = null;

DataBaseAccessor accessor = null;

DataBaseResult resultSet = null;

//Build the Query String

Query = "Select role from login where username = " + username[0] + " and password = " + password[0] ;

try{

//Determine a channel as created in the configuration

channel = LookupService.getChannel("JLU_BUSS","JLU_chan");

// Get a system accessor for a channel.As the call is being made to the database an database accessor is obtained.

accessor = LookupService.getDataBaseAccessor(channel);

// Execute the Query and get the values in the resultSet.

resultSet = accessor.execute(Query);

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

{

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

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

}

}

catch(Exception ex){

result.addValue(ex.getMessage());

}

Above is my udf.My logic is that for the given username and password it should select the corresponding role from the database.

bhavesh_kantilal
Active Contributor
0 Kudos

><i>Query = "Select role from login where username = " + username[0] + " and password = " + password[0] ;</i>

Can you let me know a few more details,

1. Is your UDF a Advanced UDF?

2. What are the import parameters defined in your UDF?

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

What is the UDF you have used?

Can you provide the input parameters and the code?

Regards

Bhavesh