sangu
08-06-2001, 12:49 AM
Hi,
I am a WINDOWS NT based programmer. I want to load picture into database and I want to access it using Java. I am using BFILE and BLOB for the same. I have created a OS Directory (c:\images) and placed an image file in it(test.jpg). Then I have created a Directory in Oracle Using following command.
create directory "dirimage" as 'c:/images';
Then I got the message 'Directory created'
Then I created a table
create table imagetest(no number(2), bfile_col BFILE);
Then I tried to insert a record using following query
insert into imagetest values(1,BFILENAME('dirimage','c:/images/test.jpg');
************
Then I tried to open that using DBMS_LOB package
CREATE OR REPLACE PROCEDURE seeIfOpenBFILE_procTwo IS
src_loc BFILE:=BFILENAME('dirimage','c:/images/test.jpg');
RetVal INTEGER;
BEGIN
/* Select the LOB, initializing the BFILE locator: */
dbms_lob.open(src_loc, dbms_lob.lob_readonly);
RetVal := DBMS_LOB.ISOPEN(src_loc);
IF (RetVal = 1)
THEN
DBMS_OUTPUT.PUT_LINE('File is open');
ELSE
DBMS_OUTPUT.PUT_LINE('File is not open');
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Operation failed');
END;
***********
When I executed the above procedure I got the error
"Non existing file or directory"
anybody please help me...............
thanks in advance
Sangu
I am a WINDOWS NT based programmer. I want to load picture into database and I want to access it using Java. I am using BFILE and BLOB for the same. I have created a OS Directory (c:\images) and placed an image file in it(test.jpg). Then I have created a Directory in Oracle Using following command.
create directory "dirimage" as 'c:/images';
Then I got the message 'Directory created'
Then I created a table
create table imagetest(no number(2), bfile_col BFILE);
Then I tried to insert a record using following query
insert into imagetest values(1,BFILENAME('dirimage','c:/images/test.jpg');
************
Then I tried to open that using DBMS_LOB package
CREATE OR REPLACE PROCEDURE seeIfOpenBFILE_procTwo IS
src_loc BFILE:=BFILENAME('dirimage','c:/images/test.jpg');
RetVal INTEGER;
BEGIN
/* Select the LOB, initializing the BFILE locator: */
dbms_lob.open(src_loc, dbms_lob.lob_readonly);
RetVal := DBMS_LOB.ISOPEN(src_loc);
IF (RetVal = 1)
THEN
DBMS_OUTPUT.PUT_LINE('File is open');
ELSE
DBMS_OUTPUT.PUT_LINE('File is not open');
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Operation failed');
END;
***********
When I executed the above procedure I got the error
"Non existing file or directory"
anybody please help me...............
thanks in advance
Sangu