Help! Trying to write to a BLOB column

I am trying to write to a BLOB column.
I insert a row with an empty BLOB (using the emppty_blob())
I then get the locator of the blob by using a select statement
that is marked 'for update' (autocommit is set to 'false')
I use the blob.getBinaryOutputStream() method to get an
outputstream and when I write outputstream.write(byte[], 0,
length) nothing happens!?
(I am trying to write a simple byte array {1,2,3,4,5,6,7,8,9,0})
Please help!
Thanks,
Eli
null

Hi,
just to exclude a simple possibility:
did you call "commit" after you've inserted/updated
the blob field?
If yes, could you please post your code?
Eli (guest) wrote:
: I am trying to write to a BLOB column.
: I insert a row with an empty BLOB (using the emppty_blob())
: I then get the locator of the blob by using a select statement
: that is marked 'for update' (autocommit is set to 'false')
: I use the blob.getBinaryOutputStream() method to get an
: outputstream and when I write outputstream.write(byte[], 0,
: length) nothing happens!?
: (I am trying to write a simple byte array
{1,2,3,4,5,6,7,8,9,0})
: Please help!
: Thanks,
: Eli
null

Similar Messages

  • 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

  • POL-3314 with BLOB columns

    When trying to import images into BLOB columns, or read them back we get this error on WIN32 (surprisingly there is no problem at all on any of the windows mobile platforms like mobile 5 or ppc2003)
    Does anyone have a fix/work around for this?
    There is a bug 5880088 with a staus of 'Closed, not feasible to fix' on metalink, with reference to a note (waiting for this from Oracle as not accessible), but would be surprised if we are the only people wanting to store images in the database

    work around is to select the data for update, rather than just select the data when wanting to retrieve BLOB data

  • Please Help - Trying to get contents of column (RepeaterRenderer)

    Hi,
    I am trying to write the contents of the table to a file but without the markups. So, I am trying to obtain the contents of the column when using RepeaterRenderer. I think this is where the contents is but I have no idea how to extract it.
    protected void rowBody(FacesContext context, UIData data,
    ResponseWriter writer) throws IOException {
    // Iterate over the UIColumn children of this UIData component
    Iterator columns = data.getChildren().iterator();
    int currentColumn = 0;
    while (columns.hasNext()) {
    // Only process UIColumn children
    UIComponent column = (UIComponent) columns.next();
    if (!(column instanceof UIColumn)) {
    continue;
    Iterator contents = column.getChildren().iterator();
    while (contents.hasNext()) {
    encodeRecursive(context, (UIComponent) contents.next());
    currentColumn++;
    So, what I am trying to do is something like "writer.write(contents.toString())" where the writer would be a Fileoutputstream object instead of a ResponseWriter. However, since contents is of type Iterator, I have no idea how do I extract the contents of the table.
    Any help and suggestions are appreciated.
    Thanks in advance!

    Be careful when you copy the address as there is a space between
    /src/compone" "nts/..... and it seems to be added even though it is not there when I posted the message.
    Thanks.

  • How to load externl files (PDF) into BLOB column.  Please help.

    Hi All,
    I've currently been working on loading many external binary files (PDF) into BLOB column. After some digging, I learn that the SQL*LOADER can be used to load data from external files into table. I also got help from another forummate mentioning to use PL/SQL procedure to do so. Since I have not done anything like this before. So, my question is what is the simple approach needed to upload PDF files into a table(there is only one table containing BLOB column in my database). In addition, the LOBs can not be query-able, I wanted to list the contents of the LOBs column to make sure that I did successfully upload data into the database. How can I do that?. I do need your help. Please direct me step by step how to do so. Your help is greatly appreciated.
    Regards,
    Trang

    Hi,
    If the following link helps to you then great.
    http://www.exefind.com/oralobeditor-P25468.html
    Regards,
    Sailaja

  • Trigger to blob column in Oracle - Need Help

    Hi,
    I need any help on Oracle Trigger
    I have two table
    - BIODATA_TABLE
    - ADM_GALERY_PICTURE
    All two table contain column SPIC_PICTURE2 that is blob column.
    If the picture column update in table BIODATA_TABLE, i want it to update also in ADM_GALERY_PICTURE,
    I have created the trigger to BIODATA_TABLE.
    When i try to update the picture, the picture on the ADM_GALERY_PICTURE does not updated.
    Below is my trigger, Please help me to correct it
    CREATE OR REPLACE TRIGGER TRANSFER_PICTURE_TRIGGER
    AFTER INSERT OR UPDATE
    ON BIODATA_TABLE
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    tmpVar NUMBER;
    BEGIN
    tmpVar := 0;
    IF UPDATING
    THEN
    UPDATE ADM_GALERY_PICTURE
    SET SPIC_PICTURE2 = :NEW.SPIC_PICTURE2
    WHERE ADM_GALERY_PICTURE.SPIC_BIODATA_ID = :NEW.SPIC_BIODATA_ID;
    END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END TRANSFER_PICTURE_TRIGGER;
    thanks

    user450549 wrote:
    Hi,
    I need any help on Oracle Trigger
    I have two table
    - BIODATA_TABLE
    - ADM_GALERY_PICTURE
    All two table contain column SPIC_PICTURE2 that is blob column.
    If the picture column update in table BIODATA_TABLE, i want it to update also in ADM_GALERY_PICTURE,
    I have created the trigger to BIODATA_TABLE.
    When i try to update the picture, the picture on the ADM_GALERY_PICTURE does not updated.
    Below is my trigger, Please help me to correct it
    CREATE OR REPLACE TRIGGER TRANSFER_PICTURE_TRIGGER
    AFTER INSERT OR UPDATE
    ON BIODATA_TABLE
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    tmpVar NUMBER;
    BEGIN
    tmpVar := 0;
    IF UPDATING
    THEN
    UPDATE ADM_GALERY_PICTURE
    SET SPIC_PICTURE2 = :NEW.SPIC_PICTURE2
    WHERE ADM_GALERY_PICTURE.SPIC_BIODATA_ID = :NEW.SPIC_BIODATA_ID;
    END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END TRANSFER_PICTURE_TRIGGER;
    thankswithout your tables & without your data we can't run or test your code.
    the picture on the ADM_GALERY_PICTURE does not updated.OK, I believe you, but what EXACTLY does occur?

  • Cfscript I'm trying to write Please help :)

    I wonder if some one could help with a cfscript I'm trying to write.
    A have a number eg
    135
    4245
    1
    I want to turn these into a string with length 6 with zeros at the start like so:
    000135
    004245
    000001
    thx 4 any ideas

    Here's a cfscript along the lines of what you asked for. There's other ways to do it, of course, but I thought this approach would be helpful to you.
    <cfscript>
    /* takes a string as an argument and adds as many zeroes as it takes to make the string be exactly 6 characters. */
    function PadWithZeroes()
    var VarToTest = "";
    var ValToReturn = "";
    var VarLen = 0;
    var DesiredVarLen = 6;
    if (StructCount(Arguments) EQ 1)
        /* Use Trim(Arguments[1]) only if you do NOT want to add zeroes to one or more empty spaces */
        VarToTest = Trim(Arguments[1]);
        VarLen = Len(VarToTest);
        TimesToLoop = DesiredVarLen - VarLen;
    if (TimesToLoop GT 0)
        for (q = 1; q LTE TimesToLoop; q = q + 1)
            VarToTest = "0" & VarToTest;
        ValToReturn = VarToTest;
        return ValToReturn;
    else
        return false;
    // the rest is for testing/viewing the function etc.
    NumberToUse = 4;
    if (IsDefined("URL.NumberToUse") AND Len(Trim(URL.NumberToUse)) LTE 6)
        NumberToUse = Trim(URL.NumberToUse);
    </cfscript>
    <cfoutput>
    <br>
    NumberToUse=#NumberToUse#
    <br>
    <br>
    PadWithZeroes(NumberToUse) = #PadWithZeroes(NumberToUse)#
    <br>
    <br>
    </cfoutput>

  • Help! Problem Updating Blob Columns

    Good day
    Please i have problems updating Blob columns storing images and doc files. can someone put me through the way out hassle free
    Thank You
    God Bless U all
    Femi

    I keep geting this error
    java.sql.SQLException: ORA-01729: database link name expected
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
    when ever i try to update The Blob colum with a Blob object retrieved by resultset.getBlob from another Blob column of a different table.
    Blob b = rset.getBlob(1);
    String x = (String)jComboBox2.getSelectedItem();     
         ps=c.prepareStatement("UPDATE PROPERTIES SET "+x+" = "+b+" WHERE NAME = ?");
         ps.setString(1, (String)jComboBox1.getSelectedItem());
         System.out.println("success");
         ps.executeUpdate();

  • How to display binary file saved in BLOB column in Discoverer PLUS /VIEWER

    HI, Friends,
    I tried to display the binary file saved in the database in BLOB column with the *.doc or *.xls fomats, but it seemed not work at all. I can display them in discoverer DESKTOP, but not the web version PLUS or VIEWER. MY Discoverer PLUS/VIEWER version is 9.0.4.45.02 and the database is 9.2.0.4. Are there any special setting/configuration in somewhere (Discoverer administration/Applicaiton server/PLUS/VIEWER?)
    Any help /information will be greatly appreciated.
    Thanks a lot.

    Hi,
    Sorry but this feature is not available in the web version of 9.0.4.45. You will have to write your own mod_plsql function to download the file.
    Rod West

  • Load JAR from BLOB column?

    I have a JAR file that load and works find when I use the loadjava utility, but my software is now being deployed to a server that I don't have remote access to and can't connect remotely to the Oracle database. I need to push out updated JAR files periodically and would like to automate the updates without requiring help from their DBA.
    Is it possible to load my JAR into a BLOB column in the database and then have it loaded from that? In my testing it appears that I can do that for a single class, but I'd like to do the entire JAR. I've tried CREATE JAVA ... USING BLOB, but that appears to be expecting a character stream (java source).
    My software is on a separate server from the database, so I don't think I can use a BFILE???
    We're using Oracle 10g.
    Thanks!

    Hi
    Sure you can do that :)
    I have done a CMS Application Archive importer into DBPrism CMS.
    Look at the code (importDir function):
    http://dbprism.cvs.sourceforge.net/viewvc/dbprism/cms-2.1/src/com/prism/cms/core/Util.java?revision=1.10&view=markup
    First you has to iterate on each entry of the JAR using ZipInputStream class, then for each entry you can create a temporary BLOB to process each "create java class using .." SQL operations.
    Here a code snipped:
    695 BLOB newContent =
    696 BLOB.createTemporary(conn, true, BLOB
    697 .DURATION_SESSION);
    698 OutputStream ow = newContent.setBinaryStream(1L);
    699 while ((size = jin.read(buff, 0, buff.length)) > 0)
    700 ow.write(buff, 0, size);
    701 ow.flush();
    702 ow.close();
    703 ow = null;
    704 cs.setBLOB(1, newContent);
    705 cs.setString(2,(isResource) ? "java resource" : "java source");
    706 cs.setString(3, classOrResourceName);
    707 cs.registerOutParameter(4,Types.VARCHAR);
    708 try {
    709 cs.executeUpdate();
    710 String loadedClass = cs.getString(4);
    711 if (!isResource)
    712 listOfLoadedClasses.put(loadedClass,classOrResourceName);
    713 log.debug(".importDir - OK loading: "+loadedClass);
    714 } catch (SQLException s) {
    715 log.warn(".importDir - Error loading: "+classOrResourceName,s);
    716 } finally {
    717 newContent.freeTemporary();
    718 }
    cs is:
    674 cs =
    675 (OracleCallableStatement)conn.prepareCall("{ call begin\n" +
    676 " update create$java$lob$table set LOB = ?, loadtime=sysdate where name = 'LOADJAVA/LOB/KEY';\n" +
    677 " execute immediate 'create or replace '||?||' named \"'||?||'\" using ''LOADJAVA/LOB/KEY''';\n" +
    678 " ? := \"NameFromLastDDL\"(0);\n" +
    679 " end }");
    Hope this help, Marcelo.

  • How to read the blob column?

    Hi,
    i wanted to store the zip file in a blob column and i also want to download the file
    i have tried in the following manner
    -- Creation of the table
    create table demo
    ( ID int,
    theblob blob);
    --insert the zip file into the table
    declare
    l_blob blob;
    l_bfile bfile;
    begin
    insert into demo values ( 5, empty_blob() )
    returning theBlob into l_blob;
    l_bfile := bfilename( 'MWDIR_TST', 'demo.zip' );
    dbms_lob.fileopen( l_bfile );
    dbms_lob.loadfromfile( l_blob, l_bfile,
    dbms_lob.getlength( l_bfile ) );
    dbms_lob.fileclose( l_bfile );
    end;
    -- Function to convert the blob into clob
    CREATE OR REPLACE FUNCTION XBLOB_To_CLOB(L_BLOB BLOB) RETURN CLOB IS
    L_CLOB               CLOB;
    L_SRC_OFFSET     NUMBER;
    L_DEST_OFFSET     NUMBER;
    L_BLOB_CSID          NUMBER := DBMS_LOB.DEFAULT_CSID;
    V_LANG_CONTEXT     NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
    L_WARNING          NUMBER;
    L_AMOUNT          NUMBER;
    BEGIN
    IF DBMS_LOB.GETLENGTH(L_BLOB) > 0 THEN
    DBMS_LOB.CREATETEMPORARY(L_CLOB, TRUE);
    L_SRC_OFFSET := 1;
    L_DEST_OFFSET := 1;
    L_AMOUNT := DBMS_LOB.GETLENGTH(L_BLOB);
    DBMS_LOB.CONVERTTOCLOB(L_CLOB,
    L_BLOB,
    L_AMOUNT,
    L_SRC_OFFSET,
    L_DEST_OFFSET,
    1,
    V_LANG_CONTEXT,
    L_WARNING);
    RETURN L_CLOB;
    ELSE
    L_CLOB:= TO_CLOB('');
    RETURN L_CLOB;
    End IF;
    DBMS_LOB.FREETEMPORARY(L_CLOB);
    END XBLOB_To_CLOB;
    -- Procedure to wtire clob into file
    CREATE OR REPLACE PROCEDURE Write_CLOB_To_File ( directory_name varchar2,filename varchar2, clob_loc CLOB )
    IS
    buffer VARCHAR2(32767);
    buffer_size CONSTANT BINARY_INTEGER := 32767;
    amount BINARY_INTEGER;
    offset NUMBER(38);
    file_handle UTL_FILE.FILE_TYPE;
    BEGIN
    file_handle := UTL_FILE.FOPEN(location => directory_name,filename => filename,open_mode => 'w',max_linesize => buffer_size);
    amount := buffer_size;
    offset := 1;
    -- READ FROM CLOB / WRITE OUT TO DISK
    WHILE amount >= buffer_size
    LOOP
    DBMS_LOB.READ(lob_loc => clob_loc,amount => amount,offset => offset,buffer => buffer);
    buffer:=replace(buffer,chr(13),'');
    offset := offset + amount;
    UTL_FILE.PUT(file => file_handle,buffer => buffer);
    UTL_FILE.FFLUSH(file => file_handle);
    END LOOP;
    UTL_FILE.FCLOSE(file => file_handle);
    END Write_CLOB_To_File;
    -- To execute use the following example
    declare TmpClob CLOB;
    begin
    select XBLOB_TO_CLOB(theblob) into TmpClob from demo where id=5;
    Write_Clob_To_File('TEMP','demo.txt',TmpClob);
    end;
    when i am excuting the above code it is not bringing the exact binary values from the database ?
    can any one help me on this?
    Thanks
    Rangan S

    On another note it's always a good idea to tell us what database version you are using e.g. 9.2.0.7 or 10.2.0.3 etc. as this will allow us to tailor our answers appropriately in case there are features we can't use because you are using an older version.
    And, when posting code, please put {noformat}{noformat} tags around it so that it keeps its formatting on the forum.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Help, how to open and display blobs from tables

    Dear all,
    I am trying to store ms-word files on a table using a blob column.
    Does anyone how to open the files and display them from a form using 9iAS?
    Thank you.
    Carlos.

    And there may be, but you won't likely find that here. Do some time searching Google and maybe you'll find code that someone was nice enough to make freely available, although I wouldn't count on it. Were i a programmer and took the time to read those docs and write the code, I'd want to be paid for my time. But there are a lot of programmers who swear by freeware! You may get lucky.

  • 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();

  • Need to create link to Word Doc in blob column in search results report

    I got the Oracle Text boolean search of word documents in a blob column of a table working.
    Now I need to be able to create a link in the results report.
    I know that Oracle creates a link for each document in the column when you attach a file, I just need to know what the link should be to allow users to open the document in the search results report.
    Right now the application is set to do a search in the attached word documents, and in the results window it shows the names of the people who match the search, but it won't allow me to create a link to their resume in the results report.
    the name of the table is CONTRACTOR_LIST and the blob column is RESUME.
    How would you go about creating a simple link to the word file in the results window?
    Here is the code for the query
    select score(1) relevance, Name, Resume
    from contractor_list
    where CONTAINS (resume, :P1_SEARCH, 1) > 0
    order by 1 desc
    That works, but I can't get it to link to the resume file.
    Here is the code I'm using for the link
    javascript:popupURL(&quot;#RESUMEL#&quot;)
    This just give me an error page and the the link is
    http://server-namer:8080/apex/[datatype]
    the error is
    Bad Request
    The HTTP client sent a request that this server could not understand.
    Thanks again!
    Edited by: gjones77 on Dec 2, 2008 6:14 AM
    Edited by: gjones77 on Dec 2, 2008 7:08 AM

    It is within the table I believe (I'm not a DBA or a developer) since I created a BLOB column and then used the file browse feature to allow users to attach a resume to the table in order to be able to perform a search of the attached documents.
    I'm just having a hard time pointing the link in the search results report to the document in the blob column.
    The information on that page is great if you're trying to create a link to the document on the initial report.
    But I created a query using Oracle Text to run a report that does a boolean search of the attached word documents in the table.
    When it displays the search results, it doesn't create a link to the document and I can't figure out how to do it.
    Here's a link the the instructions I used to create the initial search report with Oracle Text, mind you I only created the index and query, I didn't add in all the link data since they're using documents on websites and I'm using documents in a table.
    http://www.oracle.com/technology/products/database/application_express/pdf/apex_text_application_v1.6.pdf
    If you can help me with this I'd really appreciate it.
    Thanks again.
    Greg
    Edited by: gjones77 on Dec 2, 2008 8:14 AM

Maybe you are looking for

  • Invalid lv client error

    I created a .Net interop assembly with LV2009 and added it to a Visual Studio 2005 VB.net project.  When I run the project I get a "Invalid LV Client" error when it calls one of the functions in the interop assembly. Anyone got any ideas on this? Tha

  • If a movie once appear in the Itunes store, can it be removed from there?

    If a movie once appear in the Itunes store, can it be removed from there?

  • Radio Button GroupBy Key

    I need help using the RadioButtonGroupBykey. I am unable to use it in the application. I have taken a radiobuttongroupbykey and used this code in initmethod,But i get error (500   Internal Server Error Failed to process request. Please contact your s

  • Black screen on iMac i7 2,93 when warm

    Mid on 2010 imac 27 " Processor: 2,93 GHz intel core i7 GPU: ATI Radeon HD 5750 Memory(Report): 4 Go 1333 MHz For 1 month, my imac presents signs of weakness at the level of the display(posting). In normal functioning, everything takes place well. Wh

  • Mail on MacBook Pro (Intel), loses track of which IMAP messages are read

    I have this problem using two different IMAP servers (dovecot-imapd and SunONE.) Basically Mail keeps "losing track" of which messages have been read already. Messages I read and/or reply keep getting marked as unread. If I wait around long enough (o