Home » Infrastructure » Windows » inserting image file as blob :oracle 9i
inserting image file as blob :oracle 9i [message #117327] Tue, 26 April 2005 09:35 Go to next message
shiren
Messages: 2
Registered: April 2005
Location: hyd
Junior Member
Hi,
I am currently doing my masters project and i have a problem while executing the procedure
declare
v_bfile BFILE;
v_blob BLOB;
begin
insert into imagetab(imagfile)
values(empty_blob())
return imagfile into v_blob;
v_bfile:=BFILENAME('IMAGEFILES','bankofwaterfall.jpg');
Dbms_Lob.fileopen(v_bfile,Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile(v_blob,v_bfile,Dbms_Lob.Getlength(v_bfile));
Dbms_Lob.Fileclose(v_bfile);
commit;
end;
I have created a directory imagefiles and granted read on access to scott .
But still i am getting an error saying
declare
*
ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
The filename, directory name, or volume label syntax is incorrect.
ORA-06512: at "SYS.DBMS_LOB", line 504
ORA-06512: at line 9
can anyone please help me out ?
thanks in advance
shiren
Re: inserting image file as blob :oracle 9i [message #117397 is a reply to message #117327] Wed, 27 April 2005 00:48 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8922
Registered: November 2002
Location: California, USA
Senior Member
Do you have both a directory created in the operating system and a directory object created in Oracle that points to that directory? Is the directory on your server, not your client? Does Oracle have sufficient privileges to that directory? There is nothing wrong with the code that you posted by itself, as demonstrated below.

scott@ORA92> select banner from v$version
  2  /

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE	9.2.0.1.0	Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

scott@ORA92> create table imagetab
  2    (imagfile blob)
  3  /

Table created.

scott@ORA92> create or replace directory imagefiles as 'c:\oracle'
  2  /

Directory created.

scott@ORA92> declare
  2    v_bfile BFILE;
  3    v_blob  BLOB;
  4  begin
  5    insert into imagetab (imagfile)
  6    values (empty_blob())
  7    return imagfile into v_blob;
  8    v_bfile := BFILENAME ('IMAGEFILES', 'bankofwaterfall.jpg');
  9    Dbms_Lob.fileopen (v_bfile, Dbms_Lob.File_Readonly);
 10    Dbms_Lob.Loadfromfile (v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
 11    Dbms_Lob.Fileclose(v_bfile);
 12    commit;
 13  end;
 14  /

PL/SQL procedure successfully completed.

scott@ORA92> select count(*) from imagetab
  2  /

  COUNT(*)
----------
         1

scott@ORA92> select length (imagfile) from imagetab
  2  /

LENGTH(IMAGFILE)
----------------
              15

scott@ORA92> 


Re: inserting image file as blob :oracle 9i [message #129951 is a reply to message #117327] Wed, 27 July 2005 07:27 Go to previous message
SheenAntony
Messages: 1
Registered: July 2005
Junior Member
Hi,

I had faced the same problem. My directory path was specified as "\\myserver\d\someDirectory" when the directory was created in the database. It started working fine when i changed it to "d:\someDirectory".

Hope it is useful for you,

Antony Sheen, India
sheen_antony@hotmail.com
Previous Topic: HIgh CPU utilization of 64 bit Oracle on Windows/Itanium2 environment
Next Topic: Oracle 9i issues when upgrading OS
Goto Forum:
  


Current Time: Tue Dec 07 00:34:47 CST 2021