If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Help me!! Error in inserting images into table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-24-09, 02:26
pgudur pgudur is offline
Registered User
 
Join Date: Jul 2009
Posts: 9
Help me!! Error in inserting images into table

Hi all,
here is the procedure I hope this is good
but
still i am getting same error
i am sure pictures reside in photos directory as 'C:\myfiles'

CAN ANY ONE TELL ME where i am doing wrong here PLEASE...............

SQL> create or replace directory photos as 'C:\myfiles';

Directory created.

SQL> commit;

Commit complete.

SQL> grant read,write on directory photos to apps;

Grant succeeded.

SQL> commit;

Commit complete.


SQL> CREATE OR REPLACE procedure insert_img
2 (p_catalogn number,p_photo varchar2)
3 as
4 f_photo bfile;
5 b_photo blob;
6 begin
7 update sh_photo set picture=empty_blob()
8 where catalogn=p_catalogn
9 return picture into b_photo;
10 f_photo := bfilename('photos',p_photo);
11 dbms_lob.fileopen(f_photo,dbms_lob.file_readonly);
12 dbms_lob.loadfromfile(b_photo,f_photo,dbms_lob.get length(f_photo));
13 dbms_lob.fileclose(f_photo);
14 commit;
15 end insert_img;
16
17 /

Procedure created.

SQL> commit;

Commit complete.

SQL> execute insert_img(1,'Animallandscape.jpeg');
BEGIN insert_img(1,'Animallandscape.jpeg'); END;

*
ERROR at line 1:
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 504
ORA-06512: at "APPS.INSERT_IMG", line 11
ORA-06512: at line 1
Reply With Quote
  #2 (permalink)  
Old 07-24-09, 02:43
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Are you running this on the server?

dbms_lob.fileXXX can only read files that are stored on the server where Oracle runs. I can not read files locally on your harddisk.

Just noticed that you also posted in the wrong forum. This forum is for MySQL not Oracle.
Reply With Quote
  #3 (permalink)  
Old 07-24-09, 02:53
pgudur pgudur is offline
Registered User
 
Join Date: Jul 2009
Posts: 9
yes I am running on server
but
could you give me a clear idea
where i am doing wrong

regard
pgudur
Reply With Quote
  #4 (permalink)  
Old 07-24-09, 03:40
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by pgudur
where i am doing wrong
This is the wrong forum.
Why do you duplicate your post in a forum which doesn't even deal with that DBMS?
Reply With Quote
  #5 (permalink)  
Old 07-24-09, 05:18
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by pgudur
where i am doing wrong
Considering I've already told you that this is an Oracle question then I'd guess that the answer to your above question is simply your career choice.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On