0
votes

I'm trying to uploade images into a table as written in the Oracle Documentation but I receive this error: ORA-22288: file or LOB operation FILEOPEN failed No such file or directory

I created a directory into /NetbeansProjects/Pinacoteca/opere. On Oracle, I created a directory FILE_DIR AS my_path_to_opere. I granted read to my_user.

But it doesn't work.

This is the procedure:

create or replace 
PROCEDURE PRC_UPLOADIMAGE(image_id INTEGER, image_dir VARCHAR2, image_fname VARCHAR2)
AS
obj ORDIMAGE;
ctx RAW(64) := NULL;
BEGIN   
INSERT INTO image_table VALUES(image_id,ORDImage.init());  

SELECT i.image INTO obj FROM image_table i
    WHERE i.id  = image_id FOR UPDATE;

obj.importFrom(ctx,'file',image_dir,image_fname);
-- check size
DBMS_OUTPUT.PUT_LINE('Length is ' || obj.getContentLength());
DBMS_OUTPUT.PUT_LINE('Source is ' || obj.getSource());

UPDATE image_table i 
    SET i.image = obj 
    WHERE i.id = image_id;
COMMIT;

END PRC_UPLOADIMAGE;

Did you have the same problem?

1
Did you test your sql queries seperatly? To make sure they return the data you are looking for? If yes, then the error is in the procedure, if no, make sure to fix your queries.Armunin
the query work properly. The problem is at that line: obj.importFrom(ctx,'file',image_dir,image_fname); It gives me this error: ORA-22288: file or LOB operation FILEOPEN failed No such file or directory, I don't know why!GiacomoLicari
Guys now it works. Really I don't know why before not. I dropped the directory and created it from SQL DEVELOPER and not from sqlplus. Misterious!!GiacomoLicari

1 Answers

0
votes

My guess would be that your table, IMAGE_TABLE has no row in it where ID is equal to the value of IMAGE_ID which you're passing into your procedure.