Copy BLOB column  to filesystem

Hello everybody.
Im working with RedHat Linux and Oracle Database 10gR2.
My problem , I have some tables with Blob columns those Blob columns have pictures (jpg, gif etc) , and I need copy those pics ,blob colums, to filesystem.
Question : Can anybody send me a link where I can see a example of how to ?.
Thanks in advanced and regards everybody.

You can check this asktom post
Retrieving Data from BLOB into a file
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6379798216275
or search for more demo on asktom.

Similar Messages

  • How to copy one column BLOB value into another column of another database.

    How to copy one column BLOB value into another column of another database.
    BLOB value contains word document.
    I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
    Is there any other better way to do this?

    You're welcome
    BLOB fields contains binary data. I don't think you can do this
    Also if I view the BLOB as text. Can I copy it and insert into the new database.
    I think your options are as I said. Datapump or CTAS
    Best Regards

  • Copy blob images into ORDIMAGE column

    Hi
    I actually have a table (TABLE1) with a blob column. Images are Stored in this table. In order to user Intermedia Image (scale method), I need to put this images into a table (TABLE2) with an ORDIMAGE type column.
    TABLE1
    ID NUMBER
    PHOTO BLOB
    TABLE2
    ID NUMBER
    PHOTO ORDSYS.ORDIMAGE
    I'm able to insert data in the new table, but the properties of the ordimage columns are not set properly and I get IMG-704 when I try to use the setProperties method of the Ordimage columns.
    Can anyone Help ?
    Thanks
    Olivier GIBERT
    null

    Here is the proc I Use to transfer from blob table named photo to ORDIMAGE table named PHOTO_TEST
    procedure blob_to_ordimage is
    cursor get_blob_cur is
    select numphoto
    , photo
    from photo
    where rownum<50;
    localImage ordsys.ordimage;
    begin
    delete from photo_test;
    FOR get_blob_rec IN get_blob_cur
    LOOP
    localImage := ordsys.ordimage(ordsys.ordsource
    (get_blob_rec.photo,null,null,
    null,null,null),null,null,null,null,null,null,null);
    localImage.setLocal();
    insert
    into photo_test
    ( numphoto
    , photo)
    values
    ( get_blob_rec.numphoto
    , localImage);
    END LOOP;
    commit;
    end;
    this proc works fine but image properties are unset.
    If I add the following command :
    localImage.setProperties;
    after the Image.setLocal, I get ORA-704.
    Can anyone help ???
    null

  • How can I open different binary files from BLOB column ?

    If we store some type of binary file (XLS, DOC, PDF, EML and so on, not only pictures) in BLOB column how can I show the different contents? We use designer and forms 9i with PL/SQL.
    How can I copy the files from BLOB to file in a directory or how can I pass BLOB's content to the proper application directly to open it?

    The mime type is just a string as explained above (e.g. application/pdf...). There are lot of samples here and on metalink.
    E.g. add a column mime_type varchar(30) to your blob table. Create a procedure similar to the following:
    PROCEDURE getblob
    (P_FILE IN VARCHAR2
    IS
    vblob blob;
    vmime_type myblobs.mime_type%type;
    length number;
    begin
         select document, mime_type into vblob,vmime_type from myblobs where docname = p_file;
         length := dbms_lob.getlength(vblob);
         if length = 0 or vblob is null then
         htp.p('Document not available yet.');
         else
         owa_util.mime_header(vmime_type);
         htp.p('Content-Length: ' || dbms_lob.getlength(vblob));
         owa_util.http_header_close;
         wpg_docload.download_file(vblob);                
         end if;
    exception
         when others then
         htp.p(sqlerrm);
    END;
    Create a DAD on your application server (refer to documentation on how to create a DAD).
    Display the blob from forms (e.g. on a when-button-pressed trigger):
    web.show_document('http://myserver:port/DAD/getblob?p_file=myfilename','_blank');
    For storing blobs in a directory on your db server take a look at the dbms_lob package.
    For storing blobs in a directory on your app server take a look at WebUtil available on OTN.
    HTH
    Gerald Krieger

  • How to display the content of a BLOB column in a ADF/BC pages ?

    How to display the content of a BLOB column in a ADF/BC pages ?
    There is some image in database table blog column. And we want to display image on the screeen.
    There is some example about upload and dowload blog columns.
    (steve not yet document example page etc...)
    But We want to display blog picture in a image component...
    is there any basic way to do it ?
    Thanks a lot...

    Ali,
    You could just download the sample app... but... here is the servlet code from the demo (look at it just for technique - you'll obviously have to change it for your needs)...
    John
    package oracle.fodemo.storefront.servlet;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.Key;
    import oracle.jbo.Row;
    import oracle.jbo.ViewObject;
    import oracle.jbo.client.Configuration;
    import oracle.jbo.domain.BlobDomain;
    import oracle.jbo.domain.DBSequence;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.ViewObjectImpl;
    public class ImageServlet
      extends HttpServlet
      private static final String CONTENT_TYPE =
        "image/jpg; charset=windows-1252";
      public void init(ServletConfig config)
        throws ServletException
        super.init(config);
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
        throws ServletException, IOException
        response.setContentType(CONTENT_TYPE);
        response.setContentType(CONTENT_TYPE);
        String detailProductId = request.getParameter("detail");
        String thumbnailProductId = request.getParameter("thumbnail");
        boolean thumbnail = true;
        String productId = null;
        OutputStream os = response.getOutputStream();
        String amDef = "oracle.fodemo.storefront.store.service.StoreServiceAM";
        String config = "StoreServiceAMLocal";
        ApplicationModule am =
          Configuration.createRootApplicationModule(amDef, config);
        ViewObjectImpl vo =
          (ViewObjectImpl) am.findViewObject("ProductImages"); // get view object (the same as used in the table)
        if (detailProductId != null)
          productId = detailProductId;
          thumbnail = false;
        else
          productId = thumbnailProductId;
        vo.defineNamedWhereClauseParam("paramThumbnail", null, null);
        vo.defineNamedWhereClauseParam("paramProductId", null, null);
        vo.setWhereClause("DEFAULT_VIEW_FLAG = :paramThumbnail AND PRODUCT_ID = :paramProductId");
        vo.setNamedWhereClauseParam("paramThumbnail", (thumbnail? "Y": "N"));
        vo.setNamedWhereClauseParam("paramProductId", productId);
        vo.executeQuery();
        Row product = vo.first();
        BlobDomain image = (BlobDomain) product.getAttribute("Image");
        InputStream is = image.getInputStream();
        // copy blob to output
        byte[] buffer = new byte[10 * 1024];
        int nread;
        while ((nread = is.read(buffer)) != -1)
          os.write(buffer, 0, nread);
        os.close();
        vo.setWhereClause(null);
        vo.removeNamedWhereClauseParam("paramProductId");
        vo.removeNamedWhereClauseParam("paramThumbnail");
        Configuration.releaseRootApplicationModule(am, false);
    }

  • BLOB column says undefined

    Hi .
    when i create a BLOB column in the table and describe the structure it says undefined. how do i fix that. also if someone can let me know how to update a RTF content from a VB to the BLOB column in the oracle table?? Tons of thanks in advance

    You can write a BLOB- VB to Oracle database using ADO function in VB. Search in MSDN for help on BLOB function. They have a ready eg.
    Just in case you don't find it.
    Here it is:
    Just copy paste this in a form with text boxes for all ODBC parameters.
    I think you cannot read directly from a BLOB column. Don't forget to initiate a BLOB column like:
    /*LOB table for storing files*/
    Drop table FileColumn;
    Create table FileColumn
    ( REPQUE_ID NUMBER(10) NOT NULL ,
    RepText_blob BLOB default empty_blob()
    Storage (initial 50K next 50K pctincrease 0)
    tablespace TEST31ORA
    lob(RepText_blob) store as
    (tablespace ACCOUNT4
    Storage (initial 100k next 100k pctincrease 0)
    chunk 16k pctversion 10 nocache logging);
    /*initialize LOB locator by making it not null, use empty lob, this will
    insert the locator value in that column
    I did this initialize in create table script, so that I can do the bulk insert
    One can do bulk inserts if there are no rows before
    insert into FileColumn
    values(1, empty_blob()); */
    Option Explicit
    Const BlockSize = 32768
    ' FUNCTION: ReadBLOB()
    ' PURPOSE:
    ' Reads a BLOB from a disk file and stores the contents in the
    ' specified table and field.
    ' PREREQUISITES:
    ' The specified table with the OLE object field to contain the
    ' binary data must be opened in Visual Basic code (Access Basic
    ' code in Microsoft Access 2.0 and earlier) and the correct record
    ' navigated to prior to calling the ReadBLOB() function.
    ' ARGUMENTS:
    ' Source - The path and filename of the binary information
    ' to be read and stored.
    ' T - The table object to store the data in.
    ' Field - The OLE object field in table T to store the data in.
    ' RETURN:
    ' The number of bytes read from the Source file.
    Function ReadBLOB(Source As String, T As Recordset, _
    sField As String)
    Dim NumBlocks As Integer, SourceFile As Integer, i As Integer
    Dim FileLength As Long, LeftOver As Long
    Dim FileData As String
    Dim RetVal As Variant
    On Error GoTo Err_ReadBLOB
    ' Open the source file.
    SourceFile = FreeFile
    Source = "c:\blob_file_folder\G63JR557.doc"
    T = mwebRepOutput
    sField = RepOut_Content
    Open Source For Binary Access Read As SourceFile
    ' Get the length of the file.
    FileLength = LOF(SourceFile)
    If FileLength = 0 Then
    ReadBLOB = 0
    Exit Function
    End If
    ' Calculate the number of blocks to read and leftover bytes.
    NumBlocks = FileLength \ BlockSize
    LeftOver = FileLength Mod BlockSize
    ' SysCmd is used to manipulate status bar meter.
    RetVal = SysCmd(acSysCmdInitMeter, "Reading BLOB", _
    FileLength \ 1000)
    ' Put first record in edit mode.
    T.MoveFirst
    T.Edit
    ' Read the leftover data, writing it to the table.
    FileData = String$(LeftOver, 32)
    Get SourceFile, , FileData
    T(sField).AppendChunk (FileData)
    RetVal = SysCmd(acSysCmdUpdateMeter, LeftOver / 1000)
    ' Read the remaining blocks of data, writing them to the table.
    FileData = String$(BlockSize, 32)
    For i = 1 To NumBlocks
    Get SourceFile, , FileData
    T(sField).AppendChunk (FileData)
    RetVal = SysCmd(acSysCmdUpdateMeter, BlockSize * i / 1000)
    Next i
    ' Update the record and terminate function.
    T.Update
    RetVal = SysCmd(acSysCmdRemoveMeter)
    Close SourceFile
    ReadBLOB = FileLength
    Exit Function
    Err_ReadBLOB:
    ReadBLOB = -Err
    Exit Function
    End Function
    null

  • How to extract files stored in 9ifs to 9i Database Table's BLOB Column

    Dear All,
    I am new for 9ifs. Now my client need to retrieve the files which is stored in 9i Database Table's BLOB Column. Actually the files are stored in 9ifs. Therefore we now want to write a Java program to retrieve the files from 9ifs to 9i Database Table's BLOB Column for my client.
    The Java program will be loaded as Java Procedure to 9i Database. Then the Java Procedure can be triggerred by DML of 9i Database.
    The Questions are:
    1. Can I use CM SDK (9ifs) to retrieve files form 9ifs to 9i Database?
    2. If the files are already stored in 9ifs, Can I use PL/SQL to copy the files from 9ifs to 9i Database?
    3. As the Java Procedure will run frequently, Any problem on 9i Database Java Pool?
    4. Any other advices to implement the above stituation depends on the Client must use the database link to retrieve our 9i Database data?
    Thanks a lot!

    To Get MySql recordset in dreamweaver.
    1. Dreamweaver
    2. File>new>html>create>
    3. File>save>untitle-1.php (make sure to use a php externsion)
    4.Database Panel(Window>Database)
    5.Click Application Tab
    6.Click Plus sign.
    7.click Recordset(query)
    8.Name it anything
    9.Define your connection
    10.Go down to database items
    11. Click Tables
    12. Click the appropriate table
    13. click test
    14.click ok
    To pull image from MySqlDataBase
    1Place cursor on page where you want the image.
    2 insert>Image
    3Select Image Source box appears.
    4Click select file form: Data Source(vs File System)
    5 Your recordset will display
    6 Select the record.
    7 Click ok

  • Processing OrdImage data into a BLOB column

    Hi,
    I am importing 30Mb Tiff images into an ordsys.ordimage column within an image table. All is fine with the import part. I now want to populate a blob column in the same table with a jpeg generated from the tiff. I have tried many variations of the .process and .processcopy functions but I'm getting nowhere. Can anyone help?

    You will need to tell us more about what "getting nowhere" means. Are you getting errors? Or do you just not know where to begin? I'll assume the latter.
    First of all, you definitely want to use the processCopy() method. process() will overwrite your original TIFF image. If you want the JPEG in a separate column, you must use processCopy to keep the original and create a new copy. Does your JPEG image have to be in a BLOB column? Why don't you store this in an ORDImage column as well? If you store it in an ORDImage column, you can use the processCopy method. If you must use a BLOB column, you need to look at the processCopy procedure of the relational interface.
    The interMedia Quick Start Guide for the Object Interface (there is also one for the relational interface if you really must use a BLOB column for your JPEG image column), has a good example of using the processCopy method to create a JPEG thumbnail. You can find it here:
    http://www.oracle.com/technology/sample_code/products/intermedia/files/quickstart_guides/intermedia_qs_image.pdf
    See the section on Creating Thumbnails and Changing Formats.
    If you have selected the source image into an ORDImage variable imgSrc, and the destination image into a variable imgDst, the process command to create a similar JPEG image is:
    imgSrc.processCopy('fileformat=jfif', imgDst);

  • ORA-03237 when creating table with BLOB columns on Oracle 9i

    I am playing with my new Oracle 9i database. I am trying to copy
    tables from my 8.1.6 db. Three tables won't create due to this
    new message. The 9i documentation says it's soemthing to do with
    freelist groups but my DBA says he hasn't set up any.
    The tablespace is one of these newfangled locally managed
    tablespaces (predetermined size 8k).
    I can create these tables if I change the BLOB column to datatype
    VARCHAR2(4000).
    I have raised this through the usual channels, but I thought I'd
    try this site as well.
    Cheers, APC

    victor_shostak wrote:
    Figured, Virtual Columns work only for Binary XML.They are only supported, currently, for Binary XML.

  • Writing BLOBS to the filesystem

    Here's my problem.
    I know how to read any filetype into the database using a OLE
    container mapped to a BLOB column in the Oracle 8i database.
    How do I then, write the BLOB to the filesystem.
    null

    Hello AlaaShaw,
    Best practice for this type of application is to have two loops--one that handles deterministic operations and one that performs non-deterministic operations (such as writing to file or communicating to the host PC). You can transfer data between these loops using RT FIFO variables without affecting the determinism of your main loop, or with single-process shared variables. Here is a help document explaining data communication:
     http://zone.ni.com/reference/en-XX/help/371361L-01​/lvconcepts/data_comm/
    An example for how to implement this architecture can be seen here:
    http://www.ni.com/tutorial/11198/en/
     http://www.ni.com/tutorial/52028/en/
    In the future, please post to the LabVIEW RT discussion forum.  This will increase the visibly of your issue and increase the response time.
    http://forums.ni.com/t5/forums/searchpage/tab/mess​age?submitted=true&type=message&q=rt&page_size=50&​...
    Regards,
    Thomas C.
    Applications Engineer
    National Instruments

  • ORA_FFI and BLOB columns

    I'm trying to find dll library, which can write and read blob column? Can anybody help me?

    Shay, thanks for your reply.
    Is my interpretation of your advice correct?
    1. I need to use Java to replace the Delphi dll to allow me to copy/paste the client clipboard to/from a file.
    2. If the file is on the client then I will also need to use Java in place of text_io to read from the file.
    3. Could I use Java to copy to/paste from the client clipboard to a server file. That way I would not need to change the text_io code?
    Thanks
    Stewart

  • Error while importing a table with BLOB column

    Hi,
    I am having a table with BLOB column. When I export such a table it gets exported correctly, but when I import the same in different schema having different tablespace it throws error
    IMP-00017: following statement failed with ORACLE error 959:
    "CREATE TABLE "CMM_PARTY_DOC" ("PDOC_DOC_ID" VARCHAR2(10), "PDOC_PTY_ID" VAR"
    "CHAR2(10), "PDOC_DOCDTL_ID" VARCHAR2(10), "PDOC_DOC_DESC" VARCHAR2(100), "P"
    "DOC_DOC_DTL_DESC" VARCHAR2(100), "PDOC_RCVD_YN" VARCHAR2(1), "PDOC_UPLOAD_D"
    "ATA" BLOB, "PDOC_UPD_USER" VARCHAR2(10), "PDOC_UPD_DATE" DATE, "PDOC_CRE_US"
    "ER" VARCHAR2(10) NOT NULL ENABLE, "PDOC_CRE_DATE" DATE NOT NULL ENABLE) PC"
    "TFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS"
    " 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "TS_AGIMSAPPOLOLIVE030"
    "4" LOGGING NOCOMPRESS LOB ("PDOC_UPLOAD_DATA") STORE AS (TABLESPACE "TS_AG"
    "IMSAPPOLOLIVE0304" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 NOCACHE L"
    "OGGING STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEF"
    "AULT))"
    IMP-00003: ORACLE error 959 encountered
    ORA-00959: tablespace 'TS_AGIMSAPPOLOLIVE0304' does not exist
    I used the import command as follows :
    imp <user/pwd@conn> file=<dmpfile.dmp> fromuser=<fromuser> touser=<touser> log=<logfile.log>
    What can I do so that this table gets imported correctly?
    Also tell me "whether the BLOB is stored in different tablespace than the default tablespace of the user?"
    Thanks in advance.

    Hello,
    U can either
    1) create a tablespace with the same name in destination where you are trying to import.
    2) get the ddl of the table, modify the tablespace name to reflect the existing tablespace name in destination and run the ddl in the destination database, and run your import command with option ignore=y--> which will ignore all the create errors.
    Regards,
    Vinay

  • How to view PDF files strored in a BLOB column

    Hi all,
    I want to display a PDF file, stored in a BLOB column, in a form or through a JavaBean.
    But the problem is more complicated then that. I do not want to retrieve the PDF file in the application server that show it through a browser.
    Actually, I do not want users to get the entire file, I just want them to see it or print it.
    I want, in fact, to display a "stream" of bytes through Oracle Forms. Not a file.
    This one, sounded to be a good solution, but actually not. When the file was too big (multiple pages), the application was blocked until the entire file was loaded. And when you try to print it, it wasn't printed right. The advantage of this solution is that it is open-source so we can add methods to connect to the DB, retrieve the content of the BLOB column and displays it without downloading the file.
    Here is a good solution. Really good, files are loaded quickly, the rendering is really good and the file is printed perfectly (as it was printed from Adobe Acrobat). The disadvantage of this solution is that it is not open-source and is really expansive.
    As you can see, both solutions uses PJC.
    So any help, any idea to solve my problem will be highly appreciated.
    Thanks to all of you,
    Amine
    PS : I am using F&R 11gR2

    Not entirely. At least we came to the conclusion it doesn't make (much) sense to block the save option of PDFs if you want to allow printing them
    Anyway; there is of course another possibilty: you could always write your own java bean PDF reader; there are plenty of java PDF libraries available:
    Open Source PDF Libraries in Java
    The easiest way would be to choose one which can open a PDF from a URL and render it; I would retrieve the image via mod_plsql using WPG_DOCLOAD and simply use the PDF library to render the PDF. No tempfiles anyway, and if you don't implement it there is also no save button.
    cheers

  • Getting errors while writing to a BLOB column using PrepareStatement

    Hello,
    I am getting the following errors when I am trying to insert in a BLOB in the oracle 9i database:
    java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-06502: PL/SQL: numeric or value error ORA-06512: at line 205 ORA-22297: warning: Open LOBs exist at transaction commit time
    It gets inserted into the BLOB column correctly even after throwing exception.I am using the following code:
    String outputXML = outputXML //Some huge string having a length of 52k
    String pKey = "DATA-WORKATTACH-URL MELLONFINCORP-GSS-CPG E-444!20061130T211932.030 GMT";
    String createDateTime = "20061212T145931.448 GMT";
    String createOpName = "Haque, Nadeem";
    String createOperator = "ADCDTB6";
    String createSystemID = "WFE";
    String insName = "TESt INS";
    String objClass = "Data-WorkAttach-Note";
    String updateDateTime = "20061207T191900.510 GMT";
    String updateOpName = "Haque, Nadeem";
    String updateOperator = "ADCDTB6";
    String updateSystemID = "WFE";
    String label = "This is a test for label";
    String attachDate = "20061207T191900.510 GMT";
    String attachedBy = "Nadeem";
    String attachName = "Nadeem Haque";
    String note = "This is a test note";
    String refObjectKey = "E-438!20061130T211932.030";
    String replicationDate = "20061207T191900.510 GMT";
    try{
    java.sql.PreparedStatement pstmt = null;
    java.sql.Statement stmt = null;
    java.io.OutputStream tempBlobOStream = null;
    oracle.sql.BLOB tempBlob = null;
    javax.naming.Context ctx = new javax.naming.InitialContext();
    tools.findPage("tempWorkPage").putString ("testctx", ctx.toString());     
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("jdbc/gswWorkflowReportingData");
    tools.findPage("tempWorkPage").putString ("testds", ds.toString());
    java.sql.Connection conn = ds.getConnection();
    tools.findPage("tempWorkPage").putString ("testconn", conn.toString());
    java.sql.ResultSet lobDetails = null;
         try{
              byte [] ba = outputXML.getBytes();
              String query = "INSERT INTO GSW06U.pc_data_workattach(PZINSKEY,PXCREATEDATETIME,ATTACHDATE,PXUPDATEDATETIME,PXCREATEOPNAME,PXCREATEOPERATOR,PXCREATESYSTEMID,PXINSNAME,PXOBJCLASS,PXUPDATEOPNAME,PXUPDATEOPERATOR,PXUPDATESYSTEMID,PYLABEL,ATTACHEDBY,ATTACHNAME,NOTE,REFOBJECTKEY,ATTACHSTREAM) values(?,to_date(concat(substr(?,1,8),substr(?,10,6)),'YYYYMMDDHH24MISS'),to_date(concat(substr(?,1,8),substr(?,10,6)),'YYYYMMDDHH24MISS'),to_date(concat(substr(?,1,8),substr(?,10,6)),'YYYYMMDDHH24MISS'),?,?,?,?,?,?,?,?,?,?,?,?,?,EMPTY_BLOB())";
              tools.findPage("tempWorkPage").putString ("query", query);
              pstmt = conn.prepareStatement(query);
              pstmt.setString(1, pKey); // Bind PZINSKEY
              pstmt.setString(2, createDateTime); // Bind PZINSKEY
              pstmt.setString(3, createDateTime);
              pstmt.setString(4, attachDate);
              pstmt.setString(5, attachDate);
              pstmt.setString(6, updateDateTime);
              pstmt.setString(7, updateDateTime);
              pstmt.setString(8, createOpName);
              pstmt.setString(9, createOperator);
              pstmt.setString(10, createSystemID);
              pstmt.setString(11, insName);
              pstmt.setString(12, objClass);
              pstmt.setString(13, updateOpName);
              pstmt.setString(14, updateOperator);
              pstmt.setString(15, updateSystemID);
              pstmt.setString(16, label);
              pstmt.setString(17, attachedBy);
              pstmt.setString(18, attachName);
              pstmt.setString(19, note);
              pstmt.setString(20, refObjectKey);
              pstmt.execute(); // Execute SQL statement
              // Retrieve the row just inserted, and lock it for insertion of the LOB columns
              stmt = conn.createStatement();
              lobDetails = stmt.executeQuery("SELECT AttachStream FROM GSW06U.pc_data_workattach WHERE PZINSKEY = '" + pKey + "' FOR UPDATE");
              tools.findPage("tempWorkPage").putString ("idvalue", pKey);
              // Retrieve Blob streams for AttachStream column and load the sample XML
              if( lobDetails.next()) {
              //Get the CLOB from the resultset
              tempBlob = (oracle.sql.BLOB)lobDetails.getBlob(1);
              tools.findPage("tempWorkPage").putString ("pos1", "at pos1");
              // Open the temporary CLOB in readwrite mode, to enable writing
              tempBlob.open(oracle.sql.BLOB.MODE_READWRITE);
              tools.findPage("tempWorkPage").putString ("pos2", "at pos2");
              // Get the output stream to write
              tempBlobOStream = tempBlob.getBinaryOutputStream();
              tools.findPage("tempWorkPage").putString ("pos3", "at pos3");
              // Write the data into the temporary CLOB from the byte array
              tempBlobOStream.write(ba);
              // Flush and close the stream
              tempBlobOStream.flush();
              conn.commit();
              //Close everything
    tempBlobOStream.close();
              tempBlobOStream = null;
              tempBlob.close();
              tempBlob =null;
              lobDetails.close();
              lobDetails = null;
              stmt.close();
              stmt = null;
              pstmt.close();
              pstmt = null;
              conn.close(); // Return to connection pool
              conn = null; // Make sure we don't close it twice
         catch(java.sql.SQLException sqlexp) {
                   tempBlob.freeTemporary();
                   sqlexp.printStackTrace();
                   tools.findPage("tempWorkPage").putString ("SQLException", sqlexp.toString());
         catch(java.lang.Exception exp) {
                   tempBlob.freeTemporary();
                   tools.findPage("tempWorkPage").putString ("InnerException", exp.toString());
                   exp.printStackTrace();
         finally
              if (lobDetails != null) {
              try { lobDetails.close(); } catch (java.sql.SQLException e) { System.out.println(" Error while Freeing Result sets" + e.toString()); }
              lobDetails = null;
              if (stmt != null) {
              try { stmt.close(); } catch (java.sql.SQLException e) {System.out.println(" Error while Freeing java Statement" + e.toString()); }
              stmt = null;
              if (pstmt != null) {
              try { pstmt.close(); } catch (java.sql.SQLException e) {System.out.println(" Error while Freeing java PrepareStatement" + e.toString()); }
              pstmt = null;
              try{
              if (tempBlob != null) {
         // If the BLOB is open, close it
         if (tempBlob.isOpen()) {
         tempBlob.close();
         // Free the memory used by this BLOB
         tempBlob.freeTemporary();
              tempBlob = null;
              catch (Exception ex) { // Trap errors
              System.out.println(" Error while Freeing LOBs : " + ex.toString());
              if (conn != null) {
              try { conn.close(); } catch (java.sql.SQLException e) { System.out.println(" Error while Freeing Connection" + e.toString()); }
              conn = null;
    catch(java.lang.Exception e)
         tools.findPage("tempWorkPage").putString ("LangException", e.toString());
         e.printStackTrace();
    }

    Hello,
    I am getting the following errors when I am trying to
    insert in a BLOB in the oracle 9i database:
    java.sql.SQLException: ORA-00604: error occurred
    at recursive SQL level 1 ORA-06502: PL/SQL: numeric
    or value error ORA-06512: at line 205 ORA-22297:
    warning: Open LOBs exist at transaction commit
    time
    You're doing exactly what the error says, that is committing with an open LOB. Look at the following piece of code: you write in the LOB, you flush it and then commit. There is no closing of the LOB stream before committing.
    Try putting the tempBlobOStream.close() instruction before the commit.
    // Write the data into the temporary CLOB from the
    he byte array
              tempBlobOStream.write(ba);
              // Flush and close the stream
              tempBlobOStream.flush();
    nn.commit();
              //Close everything
    tempBlobOStream.close();

  • Index creation on Blob column

    I am new to InterMedia. I am trying to create an index on a blob column. I am getting a error -
    Can you please suggest me the solution of this problem.
    Thanks.......
    The following statement(s) failed to execute successfully.
    CREATE INDEX temp.ind1 ON temp.student(MOL) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS('')
    ORA-29855: error occurered in the execution of ODCINDEXCREATE routine
    ORA-20000: interMedia Text error:
    DRG-50704: Net8 listener is not running or cannot start external procedures
    ORA-28575: unable to open RPC connection to external procedure agent
    ORA-06512: at "CTXSYS.DRUE", line 122
    ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 34
    ORA-06512: at line 1
    null

    Listner problems probably. Please check the FAQ at http://technet.oracle.com/products/text/

Maybe you are looking for