GlobalMap visibility in Routines

Four Stars

GlobalMap visibility in Routines

Hi,
I made a class string OracleFunc (String conn, string param1, string param2) in a new routine to encapsulate a Oracle PLSQL function. I need this function in a tMap, that's why I don't want to use the component tOracleSP.
At the begining of the job, before my tOracleInput, I open a connection with a tOracleConnect, and I would like to re-use this connection in my class instead of opening a new hard-coded connection at each call of the function.
Apparently the connection defined at the beginning of the job is stored in the GlobalMap in the Job main class.
So let's imagine a class looking like that :
public static String Oracle_func (String conn, String parm1, String parm2) {

java.sql.Connection myConn = null;

myConn = (java.sql.Connection) globalMap.get("conn_ " + conn);
java.sql.CallableStatement statement = myConn.prepareCall("{? = call myPackage.myFunc(? ?)}");
statement.registerOutParameter(1, java.sql.Types.VARCHAR);
statement.setString(1, parm1);
statement.setString(2, parm2);
statement.execute();
result = statement.getString(1);

}
the GlobalMap is not resolved, what sould I do to see it it from my class ?
I'm beginner with java, if my question is not clear, please, feel free to ask for more details.
Thanks for your attention,
Regards,
Sylvain
Employee

Re: GlobalMap visibility in Routines

Hello,
The globalMap is not accessible from the routine (these are 2 independant units).
You may pass the globalMap as a parameter of your routine.
HTH,
Four Stars

Re: GlobalMap visibility in Routines

OK, I pass the (java.sql.Connection) globalMap.get("conn_myconnection") in parameter to my function and it works perfectly !
thanks a lot !
One Star

Re: GlobalMap visibility in Routines

Hello,
Can you tell me How to pass globalMap as parameter to Routine from tJava???
Is it possible??
or how do i make the statement 
"String filename = ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) ; "
working in a routine. Because i read globalMap can't be used in Routine.