BFILE versus BLOB

The fact is we need to store a lot of documents in archive.
I'm developing a application that archive documents on a Oracle8i database.
End-users can write these documents to the DB and read from it.
And I am trying to choose between BFILE and BLOB, keep in mind
performance consideration.
What's about performance consideration using LOB versus BFILE?
P.S.
Our platforms: OS True64, Oracle 8.1.7.
Possible protocols are FTP, Network File System protocol.
I've tested performance writing to LOB and file via FTP (from Windows
client).Writing to LOB is slightly slowly(about 15%).

Don't forget when using LOB's you have to "pay" for
rollback/commit/backup/recovery services.
In my opinion it's worth it.
In that case you don't have to worry to synchronize
BFILEs and pointers, when one of these files will be deleted
by mistake.
Michael.

Similar Messages

  • BFILE or BLOB Support in OBIEE?

    Hi Experts,
    I want to display list of files, which are located in a server directory, as hyperlinks in OBIEE report or dashboard.
    I created a sample table with BFILE and BLOB data types and imported in Administration and created sample report to access BFILE and/or BLOB presentation column. But I'm getting below error message whenever I select above objects.
    View Display Error
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. NQODBC SQL_STATE: HY000 nQSError: 10058 A general error has occurred. nQSError: 46036 Internal Assertion: Condition m_CountFields == static_cast<int32>(m_ColumnNameVector.size()), file .\Src\SQCSCacheStorageListStream.cpp, line 222. (HY000)
    SQL Issued: SELECT "IBOT_DATA#1".IBOT_FILE saw_0 FROM IBOT_DATA ORDER BY saw_0
    Please advice if there is any alternate solution to display results by using OBIEE? Like calling JavaScripts in OBIEE to display hyperlinks etc..
    Thanks in advance
    Murali.

    Unfortunately there is no way to simply reference the word or excel file through OBIEE unless they are stored on a sharedpoint server link or some thing.
    The only way you can reference them is through an URL and as you mentioned your files are not stored in an URL but in a path location.
    Ok we have couple of options now
    1. I dont know if you can add that document in shared point(some thing similar) and reference the URL. In an organisation they will have some way of storing the documents on a web server and all the users will have access to it. That is an easy way of doing it. If thats not the case lets go to option 2
    2. Convert the word document that have all the list of files that you need to show into a jpeg image and then you can simply call the image using fmap. you can simply save the file under the obiee images
    C:\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res
    3. Convert the file into html as i mentioned earlier and simply reference the whole report through static view of the report and that will take care of it as well. Also you can display the report path as a hyperlink. so that will satisfy your requirement as well
    Hope it helps
    Thanks
    Prash

  • BFILE or BLOB?

    In general what's faster? File size is around 50k each.
    10g, Linux x86.

    Well the speed here depends very much on the underlying IO system.
    BFILE doesn't get stored in the database. It's stored outside the DB on the file system of the operating system while BLOB is fully stored in the database but also here it depends what are you using (ASM, OS file system, ...)
    In general I would suggest that you go for BLOB because of following key benefits:
    * Stored inside the database
    * Read/Writeable
    * Can be cached
    * Participate fully in transactions
    * 11g has enhanced LOB (for upgrades somewhere in the future)
    This is was the concept guide says about:
    BFILE Datatype
    The BFILE datatype stores unstructured binary data in operating-system files outside the database. A BFILE column or attribute stores a file locator that points to an external file containing the data. BFILEs can store up to 8 terabytes of data.
    BFILEs are read only; you cannot modify them. They support only random (not sequential) reads, and they do not participate in transactions. The underlying operating system must maintain the file integrity, security, and durability for BFILEs. The database administrator must ensure that the file exists and that Oracle processes have operating-system read permissions on the file.
    BLOB Datatype
    The BLOB datatype stores unstructured binary data in the database. BLOBs can store up to 8 terabytes of binary data.
    BLOBs participate fully in transactions. Changes made to a BLOB value by the DBMS_LOB package, PL/SQL, or the OCI can be committed or rolled back. However, BLOB locators cannot span transactions or sessions.

  • Blobs and bfiles

    i hav tried many examples of blobs and bfiles but without any success.
    when i used bfiles it creates a directory but i cant see the directory in the drive.
    even with blobs i have never been able to insert rows into it. i cannot even use Select * from tablename if it has a blob column
    can somebody help

    The directory is created in the DB and not on your disk
    You should be able to see it with a "select * from all_directories" ( if you have enough
    permisson )
    Then when you try to select all the data of the table that contains BLOB, you can't obtain the result. But you can do :
    select DBMS_LOB.GETLENGTH(name of the column that contains BFILE or BLOBS) from tabel
    You will obtain the size of the file inserted ...
    To see the images, you have to use Dev2k for instance.
    null

  • To BFILE or to BLOB that is the question ?

    G'day all,
    I'm looking for some advice on PROs and CONS on using BFILE or BLOB. Currently I'm using BLOB to store images which is fine I guess on Oracle Std and Enterprise but when I deploy the application to customers on a laptop I'm going to use OracleXE.
    All performance looks good for Oracle XE on laptop, but a question was raised that I should have considered myself (But sliped my mind) was about how Oracle XE has 4GB Tablespace limit and how that impacts us when our database gets fully populated with Images.
    Bugger, that 4Gig will get chewed up fairly quickly :( So I'm now wondering if I should use BFILE, that should mean the Image disk usage on the Oracle Tablespace will nolonger apply as the image data is external to the database ? right ? ...
    I was wondering if any one could confirm my thoughts, and if possible give me some PROs / CONs or Catch 22's if I do go down the BFILE path ? Obviously I'm aware of directory permissions and backup policy now mean the images need to be backed up externally. But anything else critical to BFILEs would be most appreciated.
    Regards
    Mark

    G'day All,
    Just an update, I've sucessfully modified the APEX 3.0 DEMO application to use BFILE instead of BLOB for DEMO_IMAGES. I've now got a good set of PROCEDURES and FUCTIONS to work with BFILE especially an equivalent CUSTOM_IMAGE_DISPLAY for show BFILE images on web pages etc. A few lessons learnt, but one of the big ones that cause a small flap after all my hard work, was when I ran a test and uploaded 10 images of 6 mb each the APEX SYSAUX table space still increased by 65mb even though I had deleted the BLOB from the work flow table after storing the a as BFILE.
    After doing some research I located this webiste (http://halisway.blogspot.com/2007/06/reclaiming-lob-space-in-oracle.html) which explains that even though we delete records with BLOBs the LOB space is not automatically reclaimed so as the SYS user ran the following command and then rechecked the SYSAUX tablespace and all was good.
    NB: The bloody table that is used to store the uploaded files is located under FLOWS_FILES so make sure your attached to that schema else alter table complains thats it can not see table / view.
    alter session set current_schema=FLOWS_FILES;
    alter table wwv_flow_file_objects$ modify lob (blob_content) (shrink space);
    So now Oracle XE shouldn't run out tablespace too quickly now, as long as I run the above maintenance commands to reclaim space.
    One happy chappy.
    Mark

  • Image processing with BLOBS: how to write BufferedImage to a BLOB

    Hi everybody - thanks in advance for any input on that topic.
    I'm doing image processing using AWT and 2D. Images are stored in a RDBMS as BLOB Type, which I get using JDBC and convert to a BufferedImage using a JDBCImageDecoder.
    Now, I have my BufferedImage and I can process them using the appropriate filters (ConvolveOp e.g.)
    Writing the BufferedImages to disk or display on screen is easy. But I can't get to write them to a BLOB Object. Any Hint ?
    (Of course, I'm speaking of oracle.sql.BLOB objects, not java.sql.Blob).
    Thanks and have a nice day

    Billy,
    Thank you for your answer. I have two questions.
    First what that means "Bob's your uncle ?" I'm a french man, not used to english special sentences ou jargon. Would enjoy to know !
    Second, I have created a PL/SQL procedure to update my table. I face a problem.
    I want to initialize b_lob with the img_blob value but I get an error : "ORA-22922: nonexistent LOB value". WHere do my error comes from ? I am fairly new in this stuff of BLOB.
    Below my procedure.
    Thank for your kind help.
    Christian.
    create or replace
    procedure insert_img as
    f_lob bfile;
    b_lob blob;
    loops number default 0 ;
    lines number default 0;
    stmt varchar2(4000);
    cursor c1 is select img_blob, file_name, pk from photos FOR UPDATE ;
    begin
    NULL;
    dbms_output.enable(900000);
    stmt := 'SELECT COUNT(*) FROM PHOTOS';
    EXECUTE IMMEDIATE stmt INTO LINES ;
    for ligne in c1 loop
    exit when loops >= lines ;
    loops := loops+1;
    update photos set img_blob= empty_blob() where CURRENT OF C1;
    -- return img_blob into b_lob;
    b_lob := ligne.img_blob ;
    f_lob := bfilename( 'MY_FILES', ligne.file_name );
    IF (DBMS_LOB.FILEEXISTS(f_lob) != 0)
    THEN
          DBMS_OUTPUT.PUT_LINE('BFILE exist: '|| ligne.file_name || ', ligne :'|| ligne.pk);
          dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
          dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
          dbms_lob.fileclose(f_lob);
          dbms_output.put_line('ligne.pk :' || ligne.pk || ', lines : ' || lines || ', loops ' || loops);
      ELSE
        DBMS_OUTPUT.PUT_LINE('BFILE does not exist: '|| ligne.file_name || ', ligne :'|| ligne.pk);
      END IF;
    end loop;
    commit;
    end insert_img;

  • Export JPEGs from blobs (not using interMedia)

    I am storing JPEGs in blobs using the following stored procedure:
    CREATE OR REPLACE PROCEDURE load_file (fname in varchar2, sp_id in varchar2, objectid in varchar2) IS
    src_file BFILE;
    dst_file BLOB;
    lgh_file BINARY_INTEGER;
    BEGIN
    src_file := bfilename('CTEMP', fname);
    -- blob reserve
    delete from image_table where spill_id = sp_id;
    INSERT INTO image_table (spill_id, rp_objectid, image) VALUES (sp_id,objectid,EMPTY_BLOB()) RETURNING image INTO dst_file;
    -- lock blob for input
    SELECT image INTO dst_file FROM image_table WHERE spill_id = sp_id FOR UPDATE;
    -- file open
    dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
    -- length of file
    lgh_file := dbms_lob.getlength(src_file);
    -- input file
    dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
    -- update table
    UPDATE image_table SET spill_id = sp_id, image = dst_file WHERE spill_id = sp_id;
    delete from image_table where image is null;
    -- Alle Files close
    dbms_lob.filecloseall;
    -- dbms_lob.fileclose(src_file);
    COMMIT;
    END load_file;
    I need to export the JPEGs back out to .JPG files. How can I do that?
    I am running Oracle 8.1.7 on Windows 2000.
    Thanks
    Dave

    Here's how I'm doing it. We're using the web, so I'm just referencing this procedure as part of an <IMG SRC="||get_empimg?empno_in='nnnnnnn'> tag in HTML.
    I'm storing our mime-type in the file, but you'd need to specify an "image/pjpeg" mimetype if you're not storing it on an image by image basis somewhere.
    create or replace procedure get_empimg(empno_in number) as
    vblob blob;
    buffer raw(32000);
    buffer_size integer := 32000;
    offset integer := 1;
    length number;
    mimetype varchar2(40);
    begin
    select emp_pic, emp_pic_mime into vblob, mimetype
    from web_emp_tbl
    where emp_no = empno_in;
    owa_util.mime_header(mimetype);
    length := dbms_lob.getlength(vblob);
    while offset < length loop
    dbms_lob.read(vblob,buffer_size,offset,buffer);
    htp.prn(utl_raw.cast_to_varchar2(buffer));
    offset := offset + buffer_size;
    end loop;
    end;

  • How to insert a pdf or jpeg image into a blob column of a table

    How to insert a pdf or jpeg image into a blob column of a table

    Hi,
    Try This
    Loading an image into a BLOB column and displaying it via OAS
    The steps are as follows:
    Step 1.
    Create a table to store the blobs:
    create table blobs
    ( id varchar2(255),
    blob_col blob
    Step 2.
    Create a logical directory in the database to the physical file system:
    create or replace directory MY_FILES as 'c:\images';
    Step 3.
    Create a procedure to load the blobs from the file system using the logical
    directory. The gif "aria.gif" must exist in c:\images.
    create or replace procedure insert_img as
    f_lob bfile;
    b_lob blob;
    begin
    insert into blobs values ( 'MyGif', empty_blob() )
    return blob_col into b_lob;
    f_lob := bfilename( 'MY_FILES', 'aria.gif' );
    dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
    dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);
    commit;
    end;
    Step 4.
    Create a procedure that is called via Oracle Application Server to display the
    image.
    create or replace procedure get_img as
    vblob blob;
    buffer raw(32000);
    buffer_size integer := 32000;
    offset integer := 1;
    length number;
    begin
    owa_util.mime_header('image/gif');
    select blob_col into vblob from blobs where id = 'MyGif';
    length := dbms_lob.getlength(vblob);
    while offset < length loop
    dbms_lob.read(vblob, buffer_size, offset, buffer);
    htp.prn(utl_raw.cast_to_varchar2(buffer));
    offset := offset + buffer_size;
    end loop;
    exception
    when others then
    htp.p(sqlerrm);
    end;
    Step 5.
    Use the PL/SQL cartridge to call the get_img procedure
    OR
    Create that procedure as a function and invoke it within your PL/SQL code to
    place the images appropriately on your HTML page via the PL/SQL toolkit.
    from a html form
    1. Create an HTML form where the image field will be <input type="file">. You also
    need the file MIME type .
    2. Create a procedure receiving the form parameters. The file field will be a Varchar2
    parameter, because you receive the image path not the image itself.
    3. Insert the image file into table using "Create directory NAME as IMAGE_PATH" and
    then use "Insert into TABLE (consecutive, BLOB_OBJECT, MIME_OBJECT) values (sequence.nextval,
    EMPTY_BLOB(), 'GIF' or 'JPEG') returning BLOB_OBJECT, consecutive into variable_blob,
    variable_consecutive.
    4. Load the file into table using:
    dbms_lob.loadfromfile(variable_blob, variable_file_name, dbms_lob.getlength(variable_file_name));
    dbms_lob.fileclose(variable_file_name);
    commit.
    Regards,
    Simma........

  • Error in updating a blob column

    hi good morning every one,
    first of all i created directory images as 'C:\images'
    then i created table PRICUSTOMERPROOF
    Name                     Null Type        
    CUSTOMERID                    VARCHAR2(50)
    IMAGEID                            NUMBER      
    IDTYP                                 NUMBER      
    IDVALUE                            VARCHAR2(50)
    IDEXPDATE                        TIMESTAMP(6)
    IDIMAGE                            BLOB        
    ACTIVEC                            NUMBER(1)   
    USERR                              VARCHAR2(10)
    DATEE                              TIMESTAMP(6)
    DEFAULTC                        NUMBER(1)   
    CUSTOMERIDENTIFICATIONID      NUMBER 
    then i inserted all the values in the table except IDIMAGE column
    then i tried to update the column with
    DECLARE
      l_bfile  BFILE;
      l_blob   BLOB;
    BEGIN
      SELECT IDIMAGE
      INTO   l_blob
      FROM   PRICUSTOMERPROOF
      WHERE CUSTOMERID = 'Pri29098'
      FOR UPDATE;
      l_bfile := BFILENAME(upper('images'), 'Tulips.jpg');
      DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
      DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
      DBMS_LOB.fileclose(l_bfile);
    END;
    when i execute the codes i am getting
    Error report:
    ORA-22285: non-existent directory or file for FILEOPEN operation
    ORA-06512: at "SYS.DBMS_LOB", line 805
    ORA-06512: at line 12
    22285. 00000 -  "non-existent directory or file for %s operation"
    *Cause:    Attempted to access a directory that does not exist, or attempted
               to access a file in a directory that does not exist.
    *Action:   Ensure that a system object corresponding to the specified
               directory exists in the database dictionary, or
               make sure the name is correct.
    im sure the image directory exists. can any one help me in getting the errors cleared
    thanking you
    prakash

    OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    SYS                            IMAGES                         C:\images                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    SYS                            ORACLECLRDIR                   D:\PRAKASHFILES\oracleXEpath\app\oracle\product\11.2.0\server\bin\clr                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    SYS                            DATA_PUMP_DIR                  D:\PRAKASHFILES\oracleXEpath\app\oracle\admin\xe\dpdump\                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    SYS                            XMLDIR                         D:\PRAKASHFILES\oracleXEpath\app\oracle\product\11.2.0\server\rdbms\xml                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
    SYS                            ORACLE_OCM_CONFIG_DIR          C:/ADE/jaikrish_xe/oracle\ccr\state                   
    these are the directories and i also granted write and read privilege to the user
    then i executed the codes, then
    Error report:
    ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
    ORA-06512: at "SYS.DBMS_LOB", line 928
    ORA-06512: at line 13
    06502. 00000 -  "PL/SQL: numeric or value error%s"

  • Error displaying a jpg file loaded into a table with blob field

    This may not be the correct forum for this question, but if it isn't could someone direct me to the correct one.
    I have created a table with a blob field in which I have loaded a jpg image. This appeared to work correctly, but when I try to display the image in internet explorer it comes back and tells me that it doesn't recognize the file type. Enclosed is the table create, load, and display pl/sql code. Can anyone tell me what I am doing wrong. Thanks. For the mime/header I used owa_util.mime_header('images/jpg') because my image is a jpg file.
    The database is 10g
    -- Create table
    create table PHOTOS
    IMAGEID NUMBER(10),
    IMAGE BLOB,
    IMAGE_NAME VARCHAR2(50)
    load image
    CREATE OR REPLACE PROCEDURE load_file ( p_id number, p_photo_name in varchar2) IS
    src_file BFILE;
    dst_file BLOB;
    lgh_file BINARY_INTEGER;
    BEGIN
    src_file := bfilename('SNAPUNCH', p_photo_name);
    -- insert a NULL record to lock
    INSERT INTO photos (imageid, image_name, image)
    VALUES (p_id , p_photo_name, EMPTY_BLOB())
    RETURNING image INTO dst_file;
    -- lock record
    SELECT image
    INTO dst_file
    FROM photos
    WHERE imageid = p_id AND image_name = p_photo_name
    FOR UPDATE;
    -- open the file
    dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
    -- determine length
    lgh_file := dbms_lob.getlength(src_file);
    -- read the file
    dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
    -- update the blob field
    UPDATE photos
    SET image = dst_file
    WHERE imageid = p_id
    AND image_name = p_photo_name;
    -- close file
    dbms_lob.fileclose(src_file);
    END load_file;
    display image
    PROCEDURE display_image(p_id NUMBER) IS
    Photo BLOB;
    v_amt NUMBER DEFAULT 4096;
    v_off NUMBER DEFAULT 1;
    v_raw RAW(4096);
    BEGIN
    -- Get the blob image
    SELECT image
    INTO Photo
    FROM PHOTOS
    WHERE IMAGEID = p_id;
    owa_util.mime_header('images/jpg');
    BEGIN
    LOOP
    -- Read the BLOB
    dbms_lob.READ(Photo, v_amt, v_off, v_raw);
    -- Display image
    htp.prn(utl_raw.cast_to_varchar2(v_raw));
    v_off := v_off + v_amt;
    v_amt := 4096;
    END LOOP;
    dbms_lob.CLOSE(Photo);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END;
    END;
    The url I enter is: http://webdev:7777/tisinfo/tis.tiss0011.Display_Image?p_id=1

    Just a little more information. When I enter owa_util.mime_header('image/jpeg') I can't display the file. It just shows up with a red x for the file.
    When I enter owa_util.mime_header('image/jpg') it displays the file, but in the format
    ¿¿¿¿JFIF¿¿-Intel(R) JPEG Library, version [2.0.16.48]¿¿C
    This is the way I would expect it to look if I opened it with Notepad, or an application that doesn't recognize jpg files. Can anyone tell me what I am doing wrong?? Thanks.

  • Conversion of string to BLOB format

    Hi,
    Scenario is proxy to JDBC:
    I have a requirement where my PFD file name is maintained in one ABAP R3 table and I need to convert the PDF file name to BLOB format.
    Is there any function module available in R3 for converting to BLOB data type. or java mapping is required in graphical mappping for this conversion.
    My pdf file name is:
    SHELL_INC_123456789012_851000000005290_DE_04_2008.pdf
    Thnx
    Chirag

    Hi Chirag,
    I don't think there is any FM in ABAP is written for this purpose. you should need to write an UDF. Also my concern is that "where is the PDF file located"? If the answer is "on a file system accessible to the Oracle database" Then you can use directory objects and the DBMS_LOB package. It would look something like this:
    as SYS user do:
    -- assume the PDF files are in /data/documents filesystem directory
    create or replace directory pdfdir as '/data/documents';
    grant read on directory pdfdir to <USER>;
    as USER do:
    create table mydocs (id integer primary key, doc blob);
    declare
    bf bfile;
    b blob;
    src_offset integer := 1;
    dest_offset integer := 1;
    begin
    ' insert a new blob and return it to local variable
    insert into mydocs values(1, empty_blob()) returning doc into b;
    ' open the bfile for file "summary.pdf"
    bf := bfilename('PDFDIR', 'summary.pdf');
    dbms_lob.loadBlobFromFile(b, bf, dbms_lob.lobmaxsize, dest_offset, src_offset);
    ' done
    commit;
    end;
    I assumed that you are working with 2 different machines, one client, one server.
    If you are working on a single machine, there may be a simple bug in the code.
    try adding the line
    dbms_lob.open(bf, dbms_lob.file_readonly);
    between the calls to bfilename() and loadBlobFromFile()
    Also if you want to do this using java then please have a look in this link.
    http://publib.boulder.ibm.com/infocenter/idshelp/v111/index.jsp?topic=/com.ibm.jccids.doc/com.ibm.db2.luw.apdv.java.doc/doc/cjvjdlbv.html
    Hopefully this will help you.
    Regards
    Aashish Sinha

  • BLOB in Oracle Forms 6.0

    I have used the following PL/SQL code in Forms 6.0 form, for inserting an Image in the BLOB type column of a database table, taken from windows filesystem.
    DECLARE
         F_LOB BFILE;
         B_LOB BLOB;
    BEGIN
         INSERT INTO IMAGES (IMAGE_ID, IMAGE_FILE) VALUES (1, EMPTY_BLOB());
         SELECT IMAGE_FILE INTO B_LOB FROM IMAGES WHERE IMAGE_ID = 1 FOR UPDATE;
         F_LOB := BFILENAME('BLOB_FILES', 'BlueHills.JPG');
         DBMS_LOB.FILEOPEN(F_LOB);
         DBMS_LOB.LOADFROMFILE(B_LOB, F_LOB, DBMS_LOB.GETLENGTH(F_LOB));
         DBMS_LOB.FILECLOSE(F_LOB);
    EXCEPTION WHEN OTHERS THEN
         MESSAGE(SQLERRM);
         MESSAGE(SQLERRM);
    END;
    When i debug or run the form, it collapses or closes at line # 2 without giving any exception, and hense does'nt inserts the image in the column, where BLOB_FILES is the database directory object mapping to a specific windows file system directory containing images.
    I would be very thankful if anyone can help me out of this problem.

    Dear Gerd Volberg,
    I have:
    Forms Version 6.0.5.0.2
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
    and with the following statement you have made in ur last post what should I do then:
    only patch 18 is certified against this database 10 g rel. 2.
    I know many problems around blobs and clobs when using too old patch-sets.
    install the newest patch 17 and try it again. 17 is certified against 10g DB rel. 1.
    18 is only for EBS-user, so you are not allowed to install it when not running the E-Business-Suite

  • Downloading BLOB to a file using pl/sql toolkit

    Created an Oracle Reports RDF file using the reports builder (9.0.2.x).
    Uploaded the file into the database in a BLOB column using the following code:
    >>>>
    SET VERIFY OFF
    DECLARE
    p_bfile BFILE ;
    p_blob BLOB ;
    BEGIN
    p_bfile := BFILENAME('CDR_REPORTS', '&1') ;
    INSERT INTO RPTIDE (RPTID, RPTMODULE) VALUES ('&1', EMPTY_BLOB()) RETURNING
    RPTMODULE INTO p_blob ;
    DBMS_LOB.FILEOPEN(p_bfile, DBMS_LOB.FILE_READONLY);
    DBMS_LOB.LOADFROMFILE(p_blob, p_bfile, DBMS_LOB.GETLENGTH(p_bfile));
    DBMS_LOB.FILECLOSE(p_bfile);
    COMMIT ;
    END ;
    <<<<<
    Now when we try to download the same file using pl/sql web toolkit (code pasted
    below), the file downloads fine (with exact same file size as before), but no
    longer can open the file in Reports Builder anymore. Get "Cannot open file"
    error in reports builder. Is it getting corrupt or am I doing something wrong?
    >>>>
    CREATE OR REPLACE PROCEDURE filedownload(p_rpt IN VARCHAR2) AS
    p_file blob;
    p_mime_type varchar2(50);
    p_offset integer := 1;
    p_len number;
    p_buf RAW(32000);
    p_buf_size integer:= 32000;
    BEGIN
    SELECT rptmodule, 'application/x-zip'
    INTO p_file, p_mime_type
    FROM rptide
    WHERE rptid = p_rpt ;
    OWA_UTIL.MIME_HEADER(p_mime_type);
    p_len := DBMS_LOB.GETLENGTH(p_file);
    WHILE p_offset < p_len LOOP
    DBMS_LOB.READ(p_file, p_buf_size, p_offset, p_buf);
    HTP.PRN(UTL_RAW.CAST_TO_VARCHAR2(p_buf));
    p_offset := p_offset + p_buf_size;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN HTP.PRN('No document specified') ;
    WHEN OTHERS THEN HTP.P('filedownload: '||SQLERRM);
    END filedownload ;
    <<<<<

    The answer to this problem was to set the NLS_LANGUAGE for the DAD to an 8-bit character set since the database charset was 8-bit. It seems, by default, the web toolkit assumes a 7-bit character set.

  • Help:- Store Word file in database using blob

    Hai all,
    i want to store word document in database and reterieve from database but i don't have any idea i heared about blob but i don't know how to make it any one have source code or example form pls send me
    email: [email protected]

    Hello,
    First of all, you have got to be granted the privilege to read and write to the file system, this is a must to use BFile read access.
    A global function bfilename returns a bfile taking the file path as an argument is needed to construct a blob object through dbms_lob.loadfromfile.
    A very helpful example I found on orafaq follows:Create a link to the directory where the file to load in the blob is
    (connect as system then grant read privilege to your user):
    create or replace directory blob_dir as 'C:\Documents';
    Custom the following procedure that I copied from a Thread
    create or replace procedure blob_ins(p_id in number, p_filename in
    varchar2) as
    l_bfile bfile;
    l_blob blob;
    begin
    insert into blob_test(p_id, empty_blob())
    returning blob_file into l_blob;
    l_bfile := bfilename('BLOB_DIR', p_filename);
    dbms_lob.fileopen(l_bfile);
    dbms_lob.loadfromfile(l_blob, l_bfile, dbms_lob.getlength(l_bfile));
    dbms_lob.fileclose(l_bfile);
    commit;
    return;
    end blob_ins;
    You can use UTL_FILE package in another way, but this is much more safe;
    Have Fun
    Hossam Al Din

  • APEX BFILE

    I have to store graphical documents in an Oracle Database using Apex. I have designed an application based on the Sample Application for Customers, Product, Orders Page 3 and 6 using apex_util.get_blob_file_src and a File Browse Item to store the document in a BLOB field. That works perfectly.
    Now I had to change the application to store the BLOB content in a file and set a pointer in a BFILE column leaving the BLOB column empty. Therefore I wrote a view converting BFILE to BLOB and some instead of triggers to convert BLOB to BFILE.
    Then I rewrote my Apex pages using the view instead of the table. It doesn’t work. I noticed that when using the table Apex is first executing an INSERT leaving the BLOB empty and after that an UPDATE to fill the BLOB column when creating a new record. When using the view instead of the table the INSERT is executed but not the UPDATE.
    So I wanted to write a page process to update the table manually. But I found that there was no entry in the view APEX_APPLICATION_FILES generated by Apex. So I have no chance to obtain the BLOB value and use it to update my table.
    What can I do to have the BLOB content written by Apex to the table the view APEX_APPLICATION_FILES is selecting from?

    Hi
    WWV_FLOW_FILES uses APEX security mechanisms - so you cannot see any entry when selecting it
    from e.g. SQL*Plus. If you want to check the entries you need to use SQL Workshop.
    If you create a File Browse Item named P1_FILE you can select the BLOB content with
    declare
    v_lob blob;
    begin
    -- get uploaded content
    select CLOB_CONTENT into v_lob from wwv_flow_files where name = :P1_FILE;
    -- insert into own table
    insert into ...
    -- remove from WWV_FLOW_FILES after copying
    delete from wwv_flow_files where name = :P1_FILE;
    end;
    Note that you cannot insert into a BFILE - your target table column must be of the type BLOB
    Regards
    -Carsten

Maybe you are looking for

  • Take Image Of Computer And Load It Onto A Brand New MacBook Pro

    Hello, I just purchased a MacBook Pro 13". I currently have a MacBook original (White Shell with Snow Leopard) which I want to mirror completely over to the new MacBook Pro. So what I want is to completely erase (format) the new MacBook Pro and then

  • Sme device multiple channel different bridge

    Hi I am using NI 9219 I have input from three different channel configured in different bridge mode with internal excitation. I am able to acquire signal from each channel individually, But I am not able to acquire data from all channel from a single

  • How to get motion to read text from file?

    There has to be a way to do this. I have a large file of text (transcripts from a clip several minutes long) and I want to make subtitles using Motion. How can I get Motion to read the file and create a text object with the sentence/line in the file,

  • Can't See ERP Integrator in Workspace

    Hello, I have installed and apparently successfully configured ERP Integrator on 11.1.1.3, Windows 2003 R2. Now when I goto workspace -> navigate -> administer I don't see ERP Integrator. Bear in mind that I do not have ODI installed yet, (for variou

  • IPod showing Apple and dock connector icon

    I updated both iTunes and my iPod software this evening. The iPod had been working prior to this update and I had just sync-ed it with iTunes before this fiasco. After the software updates, the iPod will not connect via the USB connection on my Windo