Hello everybody,
I need to store some images into the database and then display them in web
I am facing the above error when I try to create a procedure that will load a .gif image into a table:
Enter user-name: sys as sysdba
Enter password:
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
I create the table (a demo one here):
SQL> create table tpiero.shembull_tbl
2 ( id int primary key,
3 theBlob blob
4 )
5 ;
Table created.
Then I go and create the directory:
SQL> create or replace directory TP_dir_temp as 'c:\temp';
Directory created.
I also check from the DBA_OBJECTS:
SQL> show user
USER is "SYS"
SQL> select D.OWNER, D.OBJECT_NAME, D.OBJECT_TYPE, D.CREATED, D.STATUS, D.STATUS
2 from dba_objects d
3 where UPPER(OBJECT_NAME) = 'TP_DIR_TEMP';
OWNER OBJECT_NAME OBJECT_TYPE CREATED STATUS STATUS_1
--------------------------------------------------------------------------------------------------------------------------------------------
SYS TP_DIR_TEMP DIRECTORY 05/31/2011 10:03:24 VALID VALID
I then go and create the procedure which is going to insert the images into the table:
SQL> declare
2 l_blob blob; -- binary large object datatype
3 l_bfile bfile; -- binary file datattype
4 begin
5 insert into shembull_tbl values ( 1, empty_blob() )
6 returning theBlob into l_blob;
7
8 l_bfile := bfilename( 'MY_FILES', 'SONYC.gif' );
9 dbms_lob.fileopen( l_bfile );
10
11 dbms_lob.loadfromfile( l_blob, l_bfile,
12 dbms_lob.getlength( l_bfile ) );
13
14 dbms_lob.fileclose( l_bfile );
15 end;
16 /
declare
*
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 line 9
I do not understand ....
Any idea?
Of course I am not familiar with the
SQL> create or replace directory TP_dir_temp as 'c:\temp';
but i thought I would actually see 'ohysicaly' the directory created with this command.
I am not seeing it.
I even tried to manually create the directory under the *'c:\temp'* , in order to store the .gif images
but nothing happened.
Any ideas friends?
Thank you all and regards,
Pupli