Skip to Content

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Mar 20, 2008 at 02:20 PM


    return Database.value(s1);

    instead of

    return value(s1);

    Just to clarify, make sure u r not using "Import" inside the UDF code area.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.