We help IT Professionals succeed at work.

utl_file_dir for networking

sesh2002
sesh2002 asked
on
We set utl_file_dir for file I/O with file in database server in some filepath. For within the server I know. But what should be the parameter value for file I/O to occur in client from where we are executing the PL/SQL proc. I am having oracle 8.1.6 on windows NT. If client machine is Rabix i am giving my setting:

utl_file_dir='\\Rabix'

In client we gave change/full permission to a folder in C drive called iohome and we give filepath='C:\iohome' and I am getting INVALID FILEPATH exception. Please give me the correct util_file_dir and filepath combination. ----sesh2002
Comment
Watch Question

Author

Commented:
Sorry, we gave filepath as '\rabix\home'. ---sesh2002

Author

Commented:
Sorry, we gave filepath as '\\rabix\iohome' --sesh2002

Commented:
You can not write to the client using UTL_FILE.  (Especially using NT)
You would have to write an external proc to move the file.

Commented:
Hi
You Will set directory path on database server ... Becoze when u execute Pl/sql Proc from client . Pl/sql Proc will execute in databae .... so u give the file path on  server. and if u using developer 2000 from client then
u can use text_io..

utl_file_dir='c:\iohome' (Entry in init.ora file).



Intakhab
CERTIFIED EXPERT
Top Expert 2005
Commented:
sesh2002,
   I think I understand what Intakhab answered with, although I think a comment would have been more appropriate.  I think you already know that information.

  This question has shown up a lot recently.  Bigfam5 is almost correct - you can't use UTL_FILE to write/read FROM a client.  With web applications it is the server that will perform the PL/SQL (you can't expect to download a PL/SQL Java Virtual Machine for your browser).  So, there are only a couple of options (you are attempting #1, I think):

1) Create a network shared location to which your server can write.  This may be local disk on your server that clients can share/mount, or it may be disks that the clients share to the server.  Either way, this is a security issue that needs careful attention - it could very easily be misused.  Obviously, this is also only an intranet solution.

2) Create a java application that can write to the client's disk.  This is simple to say and complex to implement.  Java operates in a "sandbox" and has no permission to write to any directory unless specifically granted by the client's java policy/security profile, or unless you create a digitally signed application that the user accepts.  More can be found on this at java.sun.com.

   So, why isn't it working?  Because the database can't see your network shares.  I'm not an NT expert, but I'd look into

1)  The full syntax for a share - Oracle may not be able to resolve your reference,
2)  How you create the share - maybe it doesn't know how to reference the "\\" references, or maybe it is in another "shell" where those names are not available (they're local to your user).  You may need to log on as Administrator (or whatever user starts Oracle) and define the shares there.
3)  When you create the shares (like, do you need to create the share reference prior to starting the DB?).  

You may be able to use an NTFS mount, or some other method, but it isn't seeing the "\\Rabix".

Good luck!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.