Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> why donot the oracle function return?
I define a orcacle java function named oscar_quote and register it to
database. When I commented the RMI call in oscar_quote, it works fine.
If I uncommented the RMI call, and I called the function on SQL plus
command line,it can finish RMI call(I think, because I can see the log
information "call com.foedero.cache.Adapter.refreshBox successfully"
in "logfile.txt"), but it cannot return(THIS IS THE PROBLEM), it seems
locked, at the same time, I tried to "dropJava" Oscar.class from the
database, it locked also. I can dropJava Oscar.class successfully
until I restarted Orcale. Who can tell me what's the problem? Thanks.
the oscar_quote function is:
CREATE or replace FUNCTION oscar_quote(ename VARCHAR2, job VARCHAR2)
RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'Oscar.quote(java.lang.String,
java.lang.String) return java.lang.String';"
the oscar.java is:
/** * Insert the type's description here. * Creation date: (30/12/2001 6:40:18 PM) * @author: Administrator */
String bb = "begin ";
java.io.FileWriter aa = null;
try {
aa = new java.io.FileWriter("d:\\logfile.txt", true); aa.write("string1=" + string1 + " String2=" + string2 + "\r\n"); aa.flush();
//this is RMI call begin
com.foedero.cache.Adapter.refreshBox(string1, string2, true);
//this is RMI call end
aa.write("call com.foedero.cache.Adapter.refreshBox successfully\r\n"); aa.close(); bb = "successful"; } catch (Exception ex) { ex.printStackTrace(); return ex.toString();