Click here to Skip to main content
14,979,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to access a folder on my PC from oracle database? In other words database is not installed on my local machine and I have created a folder on my PC 'C:\LOB' where I want to save images retrieved from database, but it is returning an ora-29283 error: invalid file operation. I am sure that directory is created because I can see it in directories folder in my database. So what could be the problem? is it because folder is created on my PC and database is somewhere else? Below is my procedure:

SQL
CREATE OR REPLACE PROCEDURE BLOB_UPDATE (file_name in varchar) IS

    file_ref UTL_FILE.file_type;
    raw_max_size constant number := 32767;

 begin

   file_ref := UTL_FILE.fopen('MY_DIR', file_name, 'WB', raw_max_size);
   -- Here it stops working ! -- 
   ....
   utl_file.fclose(file_ref);

END BLOB_UPDATE;


What I have tried:

I have tried to create another directory but I still have the same problem
Posted
Updated 7-Nov-16 22:59pm
Comments
Richard MacCutchan 8-Nov-16 4:24am
   
Where is directory MY_DIR, and what is contained in file_name?

1 solution

The database running on its server, which is not your computer (except in very rare cases).
That means that when you are writing in your SQL statement any part (c:\my_dir\my_file.txt) it is relative to the server and not to your computer...
You may use an UNC (\\my_computer\c_share\my_dir\my_file.txt), but it now opens a whole new problem of security...
So basically, even if it is possible, it is a very bad idea to directly save date from tables to files using SQL...
Do this:
1. Return the BLOB as any other data to your application
2. Save the BLOB data using standard - client side - techniques...
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900