This content has been marked as final. Show 6 replies
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Madhavi Acharya(email@example.com):
Let me give it a shot. I remember setting this parameter as UTL_FILE_DIR=* which actually specifies any directory.<HR></BLOCKQUOTE>
Hmmm, I read about this, but the Oracle8 PL/SQL Programming book recommended against this as it allows Oracle to write anywhere and can 'circumvent operating system permissions'. That sounds a little dangerous so I would like limit Oracle to a specified directory tree. Any ideas?
This is a very old thread. If you have a question you should really start your own thread for it.
In answer to your question...
UTL_FILE_DIR parameter has been deprecated since 10g.
You should no longer use the UTL_FILE_DIR parameter as it can leave security holes on your server, meaning people can access files and directories they shouldn't.
Oracle has replaced the functionality with Oracle Directories.
As SYS user:
Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';
Then, grant permission to the users who require access e.g....
Then your user (myuser in this example) will use that directory object inside your FOPEN statement e.g.
GRANT READ,WRITE ON DIRECTORY mydir TO myuser;
Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default.
fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');
965328 wrote:So you're happy for your systems to have security holes in them.... very odd. Oracle does not recommend using deprecated functionality, so the developers should be using the correct tool for the job, and that IS directory objects.
Thank you for the reply.I know it's an old thread. I should have open a new one :)
I know it's deprecated with Oracle 10g versions.
But sometimes developers does not want to go with the new changes.
Can you please still answer my original question reg the UTL_FILE_DIR?In the hours that have passed since you posted the question, you could have tested it. I can't recall if * was a special case in it's own right or whether it could be part of a directory path.... and I was wrong, it's not since 10g, it's actually since 9i R1...
So, using it is using technology that is well over a decade old. While your at it, why not go back to using Windows 98. ;)