utl_file.invalid_path exception shown, even when dir path given
514603May 27 2006 — edited May 29 2006hello all,
I am facing an issue while accessing server-file on my server machine throught the package UTL_FILE.
my procedure gives UTL_FILE.INVALID_PATH exception, where as i have given the path in the UTL_FILE_DIR (INIT.ORA) file. The whole scenario is that i connect to that folder using USER/PASSWORD. so my questions are simple:
1. Before accessing the path, should i authenticate i.e. give user id/password or
2. Should i just access the file as
f_hdlr := utl_file.fopen('/myserver/myfolder','test.txt','R');
Rest of the code is as follows:
declare
f_hdlr utl_file.file_type; -- File Handler
s varchar2(200); -- String to Store Text Data
f_dir varchar2(200):= '\\myserver\myfolder'; -- File Directory
f_name varchar2(200):= 'mohsin.dat'; -- File Name
f_mode varchar2(1):= 'R'; -- File Mode
begin
f_dir := '//myserver/myfolder';
dbms_output.put_line(f_dir);
f_hdlr := utl_file.fopen(f_dir,f_name,f_mode);
loop
utl_file.get_line(f_hdlr,s);
dbms_output.put_line(s);
end loop;
exception
-- File Read Exceptions
when NO_DATA_FOUND then
dbms_output.put_line(' No data Found in '||f_name);
utl_file.fclose(f_hdlr);
-- Utl_File Exceptions
when utl_file.invalid_path then
dbms_output.put_line(' UTL Exception: File Access not allowed/Invalid Path. ');
utl_file.fclose(f_hdlr);
-- General Exception
when OTHERS then
dbms_output.put_line(' Other Error ');
utl_file.fclose(f_hdlr);
end;
NOTE: I am using Windows XP, and my machine is not server machine, i am accessing the server-file from my server machine available on network path.
Kindly guide me, if any one have a clear idea about it.