How to insert and retrieve zip files in to blob column in oracle database?

Hi All,
I have a requirement where i need to insert zip files to BLOB and retrieve them.
Please suggest me any good example or redirect me to them.

You already have a post on this subject here: read and write compressed data from blob in ADF
Please do not post duplicate questions.

Similar Messages

  • How to insert and retreive zip files in to blob column in oracle database?

    This is the code to retrieve               
    while (rs.next() ) {
                        Blob fileBlobContent = rs.getBlob(1);
                        String fileName = rs.getString(2);                    
                        String value = rs.getString(3);
                        long fileNum = new Long(value).longValue();
                        java.io.InputStream is =
                             ((oracle.sql.BLOB) fileBlobContent).getBinaryStream();
                        FileOutputStream fos =
                             new FileOutputStream("c:\\temp\\"+fileName);
                        int c = -1;
                        while ((c = is.read()) != -1) {
                             fos.write(c);
    This is the code to insert into the row aftre inserting empty blob
                   // step 3 - now put the contents of the file
                   int length = 0;
                   int buff_size = 1024;
                   //Writer out_clob = ((oracle.sql.CLOB)fileCobContent).getCharacterOutputStream();
                   OutputStream outstream = ((oracle.sql.BLOB) fileBlobContent).getBinaryOutputStream();
                   long chars_read = data.length();
                   byte[] buffer = new byte[buff_size];
                   while ((length+buff_size) < chars_read) {
                        outstream.write(buffer, length, buff_size);
                        length += buff_size;
                        //outstream.flush();
                   // write remaining data
                   int remaining = (int)(chars_read-length);
                   outstream.write(buffer, length, remaining);
                   // steps 4-5:
                   outstream.flush();
    Any help is greatly appreciated. Thanks!

    String localStrFile = importFormFileArg.getFileName();
    try
    localStrFileExt = localStrFile                    .substring(localStrFile.indexOf(".") + 1);
         localInputStream = importFormFileArg.getInputStream();
         localBr = new BufferedReader(
         new InputStreamReader(                         localInputStream));
              /** Read line by line and count the tokens present */
         while ((localStrReadLine = localBr.readLine()) != null)
         localIntRecords++;
                        /* parse the file contents with the delimiter comma */
                        if ("xls".equalsIgnoreCase(localStrFileExt))
                             localIsMandatoryPresent = isMandatoryFieldsPresent(
                                  localStrReadLine, ',');*/
                             System.out.println(localStrReadLine+" first \n\n\n ");
                             localStk = new StringTokenizer(
                                  localStrReadLine, "\t");
                             StringTokenizer localStk1 = new StringTokenizer(
                                  localStrReadLine, ",");
    // here i am unable to getting the records pls any body helpme                                             }
    Edited by: mulamahi on Oct 26, 2007 12:32 AM

  • How can u insert and retrieve text files in any format using forms6i.

    how can u insert and retrieve text files in any format using forms6i.
    can u give me an example of an insert statement, let's assume the file is located in the a:drive.
    and retrieving the files, i would give the user a list of all the files that are in the database, the user would select one, but what command(or piece of code) would open the file in its apppropriate editor.
    e.g .pdf formatted file would open in acrobat.
    any help would be appreciated.
    Thanks
    Hussein Saiger

    the filereference class is for downloading and uploading files.
    if you want to load xml, use the xml class.
    and, if you want to write to an xml file and don't want to use server-side code, wait.

  • HOW TO READ AND OPEN Zip files IN MAIL?

    Anyone know how to open and read attached zip-files in iPhone 3G mail?
    Thanks in advance,
    Alessio

    Hi Alessio,
    The iPhone does not support reading or uncompressing .zip files.
    +Mail attachment support+
    +Viewable document types: .jpg, .tiff, .gif (images); .doc and .docx (Microsoft Word); .htm and .html (web pages); .key (Keynote); .numbers (Numbers); .pages (Pages); .pdf (Preview and Adobe Acrobat); .ppt and .pptx (Microsoft PowerPoint); .txt (text); .vcf (contact information); .xls and .xlsx (Microsoft Excel)+
    http://www.apple.com/iphone/specs.html
    Jason

  • How to download and open zip file

    Download cannot be done

    Hi ratan45,
    Does your device support the file type? There are some zip tools in the Google play store that would be helpful with unzipping.
    However if it cannot download please try this:
    #[http://www.vbaccelerator.com/home/VB/Code/vbMedia/Audio/Lossless_WAV_Compression/Sample_APE_File.asp] click on the sample zip file
    # go to about:downloads and click on the file
    # Select a app that can open zip files on your device (please find one on Google play if you do not have one)
    Do you have an example url where this is not happening?

  • How to upload a file to a BLOB column in the DB using PL/SQL???

    Hi
    I am trying to upload a file to a BLOB column in my database. I wana do this using some pl/sql procedure.I don't wana use webutil. is it possible??? and if so can anybody help me with this???
    Regards
    Shiraz

    Hello,
    This is a stored procedure sample that show how insert into CLOB, BLOB and BFILE columns
    CREATE OR REPLACE PROCEDURE Insert_document
         PC$Type IN DOCUMENT.TYP%TYPE
        ,PC$Nom IN DOCUMENT.NOM_DOC%TYPE
        ,PC$Texte IN VARCHAR2
        ,PC$Image IN VARCHAR2 
        ,PC$Fichier IN VARCHAR2
       ) IS
      L$Blob BLOB;
      L$Clob CLOB;
      L$Bfile BFILE;
      LN$Len NUMBER := dbms_lob.lobmaxsize;
      LN$Num NUMBER ;
      LN$src_off PLS_INTEGER := 1 ;
      LN$dst_off PLS_INTEGER := 1 ;
      LN$Langctx NUMBER := dbms_lob.default_lang_ctx ;
      LN$Warn NUMBER;
      BEGIN
        -- Création of new raw --
        If PC$Fichier is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Fichier );
        End if ;
        -- Creation of temporary objetcs --
        dbms_lob.createtemporary( L$Clob, TRUE ) ;
        dbms_lob.createtemporary( L$Blob, TRUE ) ; 
        -- Loading text in CLOB column --
        If PC$Texte is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Texte );
           dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
           If dbms_lob.fileexists( L$Bfile ) = 1 Then
             dbms_output.put_line(PC$Texte || ' open' ) ;
             dbms_lob.loadclobfromfile(
                                       L$Clob,                -- Destination CLOB
                                       L$Bfile,               -- Source file pointer
                                       LN$Len,                -- # bytes to read
                                       LN$src_off,            -- Source start position
                                       LN$dst_off,            -- Target start position
                                       dbms_lob.default_csid, -- CSID
                                       LN$Langctx,            -- Language Context
                                       LN$Warn);              -- Warning message
             dbms_lob.fileclose(L$Bfile);
          Else
             raise_application_error( -20100, 'Erreur ouverture ' || PC$Texte ) ;
          End if ;
        End if ;
        -- Loading image in BLOB column --
        If PC$Image is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Image );
           dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
           dbms_lob.loadblobfromfile(
                                     L$Blob,       -- BLOB de destination
                                     L$Bfile,      -- Pointeur de fichier en entrée
                                     LN$Len,       -- Nombre d'octets à lire
                                     LN$src_off,   -- Position source de départ
                                     LN$dst_off);  -- Position destination de départ
           dbms_lob.fileclose(L$Bfile);
        End if ; 
        -- Save --
        Insert into DOCUMENT (ID, NOM_DOC, TYP, UTILISE, LOB_TEXTE, LOB_DATA, LOB_FICHIER)
               Values( SEQ_DOCUMENT.NEXTVAL, PC$Nom, PC$Type, NULL, L$Clob, L$Blob, L$Bfile ) ; 
        -- Free the temporary objects --
        dbms_lob.freetemporary( L$Clob ) ;
        dbms_lob.freetemporary( L$Blob ) ; 
      END;
    /The table structure for this sample is the following:
    CREATE TABLE DOCUMENT (
      ID           NUMBER (5) PRIMARY KEY,
      TYP          VARCHAR2 (20),
      UTILISE      VARCHAR2 (30),
      LOB_TEXTE    CLOB,
      LOB_DATA     BLOB,
      LOB_FICHIER  BFILE,
      NOM_DOC      VARCHAR2 (100))
    /Francois

  • Storing a file in a BLOB field in the database through forms

    Hi, I want to have a form that lets the user choose a file he has on his client side and load this file into a BLOB field in the database.
    I know how to use "GET_FILE_NAME" to get the file, the second part is what I'm having problems with. Do I use an OLE object? How do I initailize it? Or what is the best way to go? Thanks.
    --Bassem                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Are you looking for something like this?
    DECLARE
       l_temp  clob;
       l_text  varchar2(2000);
    BEGIN
        l_temp := httpuritype('http://www.oracle.com/PO.xsd').getclob;
        l_text := substr(l_temp, 1, 2000);
        dbms_output.put_line(l_text);
    END;N.B.: Not Tested...
    Regards.
    Satyaki De.

  • Why can't I open and retrieve my files from iPhoto and my address book after importing the files from my Power mac G5 to my new Mac Pro? I get a warning that says the new OS on my Pro doesn't open files from a Power Mac. Any idea how I can fix this?

    Why can't I open and retrieve my files from iPhoto and my Address Book after importing the files from my Power Mac G5 to my new Mac Pro? I get a warning that says the new OS on my Pro doesn't open files from a Power Mac. Any idea how I can fix this?

    For your addressbook, export the files to vCard on the PowerMac, then bring them over to your Mac Pro. For your iPhoto, copy the Users -> yourname -> Pictures folder to your Desktop on the Mac Pro, and open iPhoto on the Mac Pro holding the command and option keys.  Select the library file from that Pictures folder and open it.  It should import all the pictures into iPhoto as part of the rebuild process.  Other PowerPC to Intel migration issues are covered here: https://discussions.apple.com/docs/DOC-2295

  • My daughter created a movie using iMovie, which she has worked on for a month, when trying to save it on a jump drive she was asked to "finalize" the movie...now there is no record of it at all. Any ideas how I could try and retrieve the file?

    My daughter created a movie using iMovie 11, which she has worked on for a month. When trying to save it on a jump drive she was asked to "finalize" the movie, and while this was running (quoted 13 hours!) she received an error message. Now there is no record of it at all, I have looked in trash etc. Any ideas how I could try and retrieve the file?

    The file cannot be reloaded in iMovie using File > Open Recent  ??
    There is no trace of the file in a Spotlight search?
    The project files are not under <user>/Movies/iMovie Projects ??
    Finalizing creates small, medium and large version of the finished video. It does take a long time, but it should not destroy your project files.
    Oh, and you really MUST have a backup of your files. You can expect to lose files if you have no other copies of them.

  • Is there a way to restore photos from Drop box to my desktop iPhoto in a large batch instead of one at a time? I tried and a zip file was downloaded but won't open. Says file format not recognized.

    Is there a way to restore photos from Drop box to my desktop iPhoto in a large batch instead of one at a time? I tried and a zip file was downloaded but won't open. Says file format not recognized. I see how to do it one at a time with the "download" button in Dropbox but that's so cumbersome for lots of photos.

    Have you tried these avenues?
    Contact us - Dropbox
    Dropbox Help Center
    Dropbox Forums
    Submit a help request - Dropbox
    OT

  • I want to read a file which is in a zip and this zip file is at ftp site

    i am facing this problem and try to find the solution from last month please help me
    i want to read a file which in ziped and this zip file is at ftp site. and i want to read this file without downloading this zip file to local machine. i have to read it from ftp location only

    You can open an URLConnection to a file on an FTP server (search this forum to find out how). You can get the InputStream from the URLConnection and feed it to ZipInputStream. That should do the job.

  • File Lock - How to lock and unlock a file ? Can we do that for an FTP File?

    Hi All,
    I like to retrieve a file from the FTP server using Apache Commons Net libraries.
    for example if the file size is 20MB. When the file is in the progress of copying or transferring from the FTP server i need to lock the local file which is in our local directory so that no other process will use the same local file which is in the process of copying otherwise partially copied files will be used by another process.
    the file should be locked when it was in the progress of copying from the server. I have an automatic process which will access file objects at certain time and try to process the files.
    I like to know the simplest and easiest way to lock and unlock a file object locally which is trying to copy a file from the FTP server which is of huge size.
    And also i like to know how to lock and unlock a file in general?
    Thanks,
    J.Kathir

    we can set it read only only when it complete finishing the writing.
    can we able to make the file as read-only while transferring data to file.
    How to achieve it ? pls give me some sample code

  • How to insert text in existing file.?????

    how to insert text in existing file.?????
    my file contains simple text with numbers of lines having more then 10 MB size and it might be increase up to 100MB.
    i required to seek to spec. position and insert chunk of characters to file without overwriting existing one.
    I tried out with RandomAccessFile class Also.
    Pl. Suggest me way to insert String in existing file.
    Thanks ,
    Timir

    how to insert text in existing file.?????You can't "insert" text into an existing file. You can
    overwrite portions of an existing file or extend one by
    writing past the current end of file.
    If you want to insert text into a file you have to write
    out a new file.

  • How to create and sign CAB files info on Supplement Option

    To all Supplement Option subscribers:
    At the supplement option for iDevelopment Accelerators, I uploaded a zip with detailed info on how to create and sign CAB files (necessary when you are running your application on the Native IE Java Virtual Machine).
    Not all functionality provided to you through JInitiator will work (e.g. WebUtil doesn't) but the way how to make and sign a CAB file will become more easy.
    Cheers,
    Marc Vahsen
    Headstart Team

    This defeats the purpose of trying to centralize SAP-related web resources on the SAP server. Typically IIS/Apache or other non-SAP servers are under the control of IT and not the SAP BASIS group.
    We simply would like to have a centralized location to store static web files so that they are not overwritten during Portal support pack applications.

  • How to insert and delete fragments by clicking a button and how to script it?

    I have a  question on livecycle. I am collecting the inventor information as a bunch of text fields, each asking for a certain details. Please see below
    Now I have grouped them all in to one fragment called inventordetails and saved as .xdp file, so I could reuse this entire block. I want to add a button underneath this block, “ADD MORE INVENTORS” and when clicked this will insert another block and so forth and so on. However I was not sure as to how to insert and delete a fragment. Do  you think you can help with this? I appreciate any help in this regard.
    Best
    Subashini

    1.       I have a subform1 which is flowed
    2.       I have subform2 inside subform1 which is positioned
    3.       Inside subform2 I have two buttons 1. ADD INVENTOR 2. DELETE INVENTOR
    4.       Also inside subform1 I insert a fragment called inventor
    Now I want to script the buttons so that when clicked the inventor fragment either gets inserted again or deleted.
    I greatly appreciate any help in this regard.
    Best
    Subashini

Maybe you are looking for

  • BAPI for Open Sales Order

    Experts, I need a BAPI for list of Sales order against which the invoice has not been generated.  I need to pass date and bapi shall return list of sales order that are not invoiced. Thanks Harsh

  • 10.5.8 update corrupted the Volume Structure of my MacBook Pro and iMac

    After installing the 10.5.8 update on my Macbook Pro AND my iMac, BOTH computers refuse to boot up. If I boot from a TechTool Deluxe DVD and run the system scan, It fails both the Directory Scan and the Volume Structure test. The only common applicat

  • Why do Apple not support bluetooth?

    Why do Apple not support basic bluetooth profiles? Why can I not use BT file sharing with my PC? Why can I not use generic HID on PC? All other smartphones on the market support this. Do Apple not want PC customers?

  • I wanted to know what versions of Firefox are currently supported with security releases by Mozilla.

    I wanted to know what versions of FireFox are currently being supported by Mozilla with security updates. Thank you.

  • PIX/ASA Failover conditions

    I have a asa cluster in active/standby mode with lan cable connected for stateful failover. I want to know about the condtions when the box fails over to the other. One parameter should be the hello timers going between the failover interfaces. Does