Skip to Content
Mar 20, 2008 at 02:14 PM

DB Lookup using the Java file error


Hi All

I have written an Java file which is taking care of the connection to the DB (Oracle 10g) and on XI server i have loaded the required driver file in the LIB Folder of the JDK of the XI server.

when i run the Java code using the commnad prompt i am able to retirve the value from the Oracle.....

I created the jar file of the .Java & .class file and imnported into the SWCV in IR.

now in the UDF i am calling to an method in Java file with String value and returing string as output

the code in the Java File is ( Imported into Archieve in SWCV)


import java.sql.*;

public class Database


String Language_Desc;

public String value(String purchaseorderno) throws Exception




Connection connection = null;

Statement stmt = null;

ResultSet rst = null;

String driverName = "oracle.jdbc.driver.OracleDriver";


// Create a connection to the database

String serverName = "";

String portNumber = "1521";

String sid = "ORACLEDB";

String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;

String username = "SAPXI";

String password = "SAPXI";

connection = DriverManager.getConnection(url,username, password);

stmt = connection.createStatement();

rst = stmt.executeQuery("select PURCHASE_ORDER_NO from ORDER_HEADER where PURCHASE_ORDER_NO='"purchaseorderno"'");

if (


Language_Desc = rst.getString(1);



catch(Exception e)




return Language_Desc;



this Code is imported in a Jar file into IR and in UDF i am mnaking this code


public String DB(String a,Container container)


String s1= a;

return value(s1);


i am getting this error:

Source code has syntax error: E:/usr/sap/CE6/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map9ac4aa30f68711dcc76200145e183daa/source/com/sap/xi/tf/ cannot resolve symbol symbol : method value (java.lang.String) location: class return value(a); ^ 1 error

Kindly let me know where i am gng wrong.....

Edited by: Nisar Khan on Mar 20, 2008 7:45 PM