Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Java Stored Procedure and UNC Paths
Hi everyone!
I know there were several postings about my problem, but none of them were helpfull for me. So here's my Problem, that i've downsized to explain it easily:
I want to create a Java Stored Procedure which tells me whether a File with an UNC Path exists or not.
The java function in class ReadTest looks like:
---------code------------------------------------------
import java.io.*;
public class ReadTest
{
public static String read(String path)
{
File file = new File(path);
System.out.println(file.getAbsolutePath()); if (file.exists()) { System.out.println("File exists"); return "File exists"; } else { System.out.println("File doesn't exist"); return "File doesn't exist"; }
public static void main(String[] args) {
read(args[0]);
}
}
---------code------------------------------------------
The PL/SQL function looks like:
---------code------------------------------------------
CREATE OR REPLACE
FUNCTION ReadTest2 (
path IN VARCHAR2
) RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'ReadTest.read(java.lang.String) return java.lang.String';
---------code------------------------------------------
If i call it from the command line by
java ReadTest c:\temp\test.txt or
java ReadTest \\myComputer\share\test.txt
i always get "File exists" which is right.
If i call the PL/SQL Function by
RESULT := READTEST2('c:\temp\test.txt');
i get "File exists". Correct!
BUT if i call the function by
RESULT := READTEST2('\\myComputer\share\test.txt');
i get "File doesen't exist".
I changed the User for OracleServiceXXXX . Same problem.
I am using Oracle 8.1.7i and used loadjava.
Anyone any idea? Feel free to mail me.
OliS! Received on Wed Apr 24 2002 - 11:28:25 CDT