Retrieving contents of a BLOB column using XSQL

I am using a simple XSQL page to retrieve some data from a 9i database and the majority of it works fine.
When I try and retrieve data from a BLOB column I just get a stream of numbers in the result when I am expecting to see some XML data.
Query:
<xsql:query>
SELECT GLOBALINDEXEDBLOB FROM {@db} WHERE {@where}
</xsql:query>
Result:
<?xml version = '1.0'?>
<a-query db="ODMM_CONTENTSTORE" where="id=1">
<DETAIL>
<ROWSET><ROW num="1"><GLOBALINDEXEDBLOB>3C3F786D6C2076657273696F6E3D22312E30223F3E0A3C212D2D20467261676D6 ....
</GLOBALINDEXEDBLOB></ROW></ROWSET>
</DETAIL>
</a-query>
Any ideas what I'm doing wrong here ?
Thanks in advance
Niels Montanana

Hi
Have you read through this in the help?
Home > Advanced Programming Techni... > About BLOB Support in Forms... > About BLOB Support in Reports
I'm not sure if it's in 2.2 though...
Cheers
Ben

Similar Messages

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

  • Populating  a blob column using insert?

    please help,
    i have tried populating a blob column using forms,
    how can i do it programatically the easiest way.
    thank you.
    [email protected]

    hi jully,
    create table demo
    ( id int primary key,
    theBlob blob
    create or replace directory my_files as
    '/export/home/tkyte/public_html';
    declare
    l_blob blob;
    l_bfile bfile;
    begin
    insert into demo values ( 1, empty_blob() )
    returning theBlob into l_blob;
    l_bfile := bfilename( 'MY_FILES', 'aria.gif' );
    dbms_lob.fileopen( l_bfile );
    dbms_lob.loadfromfile( l_blob, l_bfile,
    dbms_lob.getlength( l_bfile ) );
    dbms_lob.fileclose( l_bfile );
    end;
    ako din!
    jully manuel
    jmanuel@sqlwizard
    http://sqlwizard.com

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

  • How To Print the contents of a BLOB Column on a report?(Word Document)

    Requirement: The word document will be inserted in a BLOB Column and the data in the word document has to be shown on the reports or the user should be able to see the word document (atleast he should be able to view the contents)?
    The data is getting loaded in the database but not sure how to proceed further.
    Any inputs on how to proceed will be appreciated.
    Thanks.

    in JComponent there is a method called print(Graphics g)
    you can use that with a Printable class
    read bout the java.print package in the java doc

  • To upload a PDF file in BLOB column using Oracle Forms 9i

    Can anyone tell me how to upload a PDF file from client system using File dialog window and store its content in BLOB column in a table. The file to be uploaded will be in client side.

    Take a look at the following :
    Re: Storing a PDF in a BLOB
    Re: Retrive Image from DB into Image_item
    although the threads above are reffered to images and word doc... the procedure/steps are the same....
    Greetings...
    Sim

  • To see the content of a BLOB column from sqlplus

    Hi,
    I have a table which has a BLOB column.
    The blobs are text files.
    Is there a way to check the content of blob column from sqlplus itself.
    Thanks.

    There's no information about versin of database
    If you're using 11g, then refer to this link:
    http://dbathoughts.blogspot.com/2008/05/blob-support-in-sqlplus.html
    If you're using 10g, then refer to this link
    http://www.experts-exchange.com/Database/Oracle/Q_20419597.html
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • How to display the content of a BLOB column in a JSP page?

    Hi,
    I've a db table with a Blob column which contains an image (".gif" file). I've created a UIX JSP page with the wizard, but I cannot display my image.
    This is my code:
    <%@ page errorPage="errorpage.jsp" contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui" prefix="uix" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui/bc4j" prefix="bc4juix" %>
    <%-- Define Application Module and DataSource--%>
    <jbo:ApplicationModule configname="PackageTest.PackageTestModule.PackageTestModuleLocal" id="app1" />
    <jbo:DataSource id="ds1" appid="app1" viewobject="ProvaMediaView" rangesize="1" />
    <%-- Main page contents go here --%>
    <uix:contents>
    <uix:form name="form1" method="POST">
    <uix:labeledFieldLayout >
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <%if(dsAttributes.getName().compareTo("Image")==0){
    %>
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <jbo:EmbedImage datasource="ds1" mediaattr="Image" />
    <%}else{%>  
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <bc4juix:InputRender datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <%}%>
    </jbo:AttributeIterate>
    </uix:labeledFieldLayout>
    <uix:formValue name="RowKey" value="<%= sRowKey%>" />
    </uix:form>
    </uix:contents>
    and this is the error on running the page:
    oracle.jbo.domain.BlobDomain
    Exception Details
    javax.servlet.jsp.JspException: oracle.jbo.domain.BlobDomain
         int oracle.ord.html.jsp.datatags.ShowEmbedImageTag.doStartTag()
         void Media_Edit._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
         void oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    How can I do?
    Thanks in advance.

    Hi,
    I've a db table with a Blob column which contains an image (".gif" file). I've created a UIX JSP page with the wizard, but I cannot display my image.
    This is my code:
    <%@ page errorPage="errorpage.jsp" contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui" prefix="uix" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui/bc4j" prefix="bc4juix" %>
    <%-- Define Application Module and DataSource--%>
    <jbo:ApplicationModule configname="PackageTest.PackageTestModule.PackageTestModuleLocal" id="app1" />
    <jbo:DataSource id="ds1" appid="app1" viewobject="ProvaMediaView" rangesize="1" />
    <%-- Main page contents go here --%>
    <uix:contents>
    <uix:form name="form1" method="POST">
    <uix:labeledFieldLayout >
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <%if(dsAttributes.getName().compareTo("Image")==0){
    %>
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <jbo:EmbedImage datasource="ds1" mediaattr="Image" />
    <%}else{%>  
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <bc4juix:InputRender datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <%}%>
    </jbo:AttributeIterate>
    </uix:labeledFieldLayout>
    <uix:formValue name="RowKey" value="<%= sRowKey%>" />
    </uix:form>
    </uix:contents>
    and this is the error on running the page:
    oracle.jbo.domain.BlobDomain
    Exception Details
    javax.servlet.jsp.JspException: oracle.jbo.domain.BlobDomain
         int oracle.ord.html.jsp.datatags.ShowEmbedImageTag.doStartTag()
         void Media_Edit._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
         void oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    How can I do?
    Thanks in advance.

  • Updating a blob column using a ResultSet

    Hi,
    I'm using jdeveloper 3.2.3 with a 9i database and the smartupload component to save file in a blob column.
    I'm using the following code
    String sSql0 = "SELECT DOCUMENT.NEXTVAL FROM DUAL";
    oracle.jbo.html.jsp.JSPApplicationRegistry appRegistry = oracle.jbo.html.jsp.JSPApplicationRegistry.getInstance();
    appRegistry.registerApplicationFromPropertyFile(session,"dgpa_bd_BdModule");
    ApplicationModule am = appRegistry.getAppModuleInstance("dgpa_bd_BdModule",request,session);
    ApplicationModuleImpl appMod = (ApplicationModuleImpl)am;
    PreparedStatement stmt1 = appMod.getDBTransaction().createPreparedStatement(sSql0, 1);
    String sSql2 = "SELECT t.* FROM TGTDOCD0 t WHERE IDOCUMEN = 32";
    Statement stmt2 = stmt1.getConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stmt2.executeQuery(sSql2);
    if (rs.next()) {
    // Initialization
    mySmartUpload.initialize(pageContext);
    // Upload
    mySmartUpload.upload();
    // Add the current file in the DB field
    mySmartUpload.getFiles().getFile(0).fileToField(rs,"gdocumen"); //gdocumen is the blob column
    // Update
    rs.updateRow();
    rs.close();
    stmt2.close();
    But when i run the rs.updateRow() i have the follwing error: java.sql.SQLException: ORA-01008
    what's i'm doing wrong?
    Thanks
    RJC

    Where is the image coming from? Are you getting it from a file? User Upload?
    Here is an example using a procedure in Oracle to upload a file to a blob..: http://technologydribble.info/index.php/category/load-file-into-blob/
    Thank you,
    Tony Miller
    Webster, TX
    You know, um…I used to think that it was awful that life was so unfair. Then I thought, wouldn't it be much worse if life were fair, and all the terrible things that happen to us come because we actually deserve them? So, now I take great comfort in the general hostility and unfairness of the universe
    Anla-shok Marcus from Babylon 5

  • How to insert  data into BLOB column  using sql

    Hi all,
    How to insert data into BLOB column directly using sql .
    create  table temp
      a blob,
      b clob);
    SQL> /
    Insert into temp  values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ;
    ERROR at line 1:
    ORA-01465: invalid hex number
    Please help in this.Thanks,
    P Prakash

    see this
    How to store PDF file in BLOB column without using indirect datastore

  • How to upoad a file (pdf) contents in database BLOB column

    I am new to ADF and developing a UI page using which users can insert a row in the database (by giving some input values on the page) and then upload a pdf file belonging to the inserted row (using upload button against that row which is shown on the UI after insertion) and save its data in BLOB solumn of database column.
    I am using jdeveloper 11.1.1.5 Can anyone please guide me how can I achieve this upload funcationlity. Thanks

    This had been asked frequently. ..
    Re: Upload and download blob in ADF
    Timo

  • Trying to retrieve content from a text field & use it in a conditional statement

    Hi Everyone,
    I have a form with a text field and a button. The  text field is called "orderNo", and the button is called "genOrder".
    Initially  the text field is empty, and clicking on the button fills the text  field with an appropriate order number.
    I need to check the text  field for data (content) before writing the order number to it, this  way if an order number is already present in the text field it will not  be over written.
    My intention is to use an if / else structure to  perform the testing, however I don't know how to retrieve the content  of the text field (if content is present!).
    If anybody can  suggest how I can go about retrieving the content of the text field and  then use it in an if / else statement it will be greatly appreciated.
    Kind  Regards,
    Davo

    Hi try67,
    Thanks for your assistance. I have posted in this http://www.acrobatusers.com/forums/aucbb/viewtopic.php?pid=70276#p70276 forum asking for further assistance if your able to help more.
    Once again thanks for your time.
    Cheers
    Davo

  • 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

  • PHP 5 Code to Upload and Retrieve an Image (aka BLOB) with Oracle

    I keep being asked about BLOBs. For posterity, here is my example updated
    to use the new PHP 5 OCI8 function names, and using bind variables for the BLOB id.
    -- cj
    <?php
    // Sample form to upload and insert an image into an ORACLE BLOB
    // column using PHP 5's OCI8 API. 
    // Note: Uses the new PHP 5 names for OCI8 functions.
    // Before running this script, execute these statements in SQL*Plus:
    //   drop table btab;
    //   create table btab (blobid number, blobdata blob);
    // This example uploads an image file and inserts it into a BLOB
    // column.  The image is retrieved back from the column and displayed.
    // Make sure there is no whitespace before "<?php" else the wrong HTTP
    // header will be sent and the image won't display properly.
    // Make sure php.ini's value for upload_max_filesize is large enough
    // for the largest lob to be uploaded.
    // Tested with Zend Core for Oracle 1.3 (i.e. PHP 5.0.5) with Oracle 10.2
    // Based on a sample originally found in
    //     http://www.php.net/manual/en/function.ocinewdescriptor.php
    $myblobid = 1;  // should really be a unique id e.g. a sequence number
    define("ORA_CON_UN", "hr");             // username
    define("ORA_CON_PW", "hr");             // password
    define("ORA_CON_DB", "//localhost/XE"); // connection string
    if (!isset($_FILES['lob_upload'])) {
    ?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"
       enctype="multipart/form-data">
    Image filename: <input type="file" name="lob_upload">
    <input type="submit" value="Upload">
    </form>
    <?php
    else {
      $conn = oci_connect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB);
      // Delete any existing BLOB so the query at the bottom
      // displays the new data
      $query = 'DELETE FROM BTAB WHERE BLOBID = :MYBLOBID';
      $stmt = oci_parse ($conn, $query);
      oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
      $e = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
      if (!$e) {
        die;
      oci_free_statement($stmt);
      // Insert the BLOB from PHP's tempory upload area
      $lob = oci_new_descriptor($conn, OCI_D_LOB);
      $stmt = oci_parse($conn, 'INSERT INTO BTAB (BLOBID, BLOBDATA) '
             .'VALUES(:MYBLOBID, EMPTY_BLOB()) RETURNING BLOBDATA INTO :BLOBDATA');
      oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
      oci_bind_by_name($stmt, ':BLOBDATA', $lob, -1, OCI_B_BLOB);
      oci_execute($stmt, OCI_DEFAULT);
      // The function $lob->savefile(...) reads from the uploaded file.
      // If the data was already in a PHP variable $myv, the
      // $lob->save($myv) function could be used instead.
      if ($lob->savefile($_FILES['lob_upload']['tmp_name'])) {
        oci_commit($conn);
      else {
        echo "Couldn't upload Blob\n";
      $lob->free();
      oci_free_statement($stmt);
      // Now query the uploaded BLOB and display it
      $query = 'SELECT BLOBDATA FROM BTAB WHERE BLOBID = :MYBLOBID';
      $stmt = oci_parse ($conn, $query);
      oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
      oci_execute($stmt, OCI_DEFAULT);
      $arr = oci_fetch_assoc($stmt);
      $result = $arr['BLOBDATA']->load();
      // If any text (or whitespace!) is printed before this header is sent,
      // the text won't be displayed and the image won't display properly.
      // Comment out this line to see the text and debug such a problem.
      header("Content-type: image/JPEG");
      echo $result;
      oci_free_statement($stmt);
      oci_close($conn); // log off
    ?>

    I am using oracle 10g [10.2.0.1.0] and PHP 4.3.9 with Apache.
    I tried my best to change the old functions names for example(oci_fetch)
    to the new (OCIFetch),i works every where, but i could not find the corresponded functions of (oci_fetch_assoc) that's why i can not see my BLOBS at all!
    Can some help me please, to know where are corresponded functions of oracle 8 to oracle 10g?
    Exactly here is my problem:
    $query = 'SELECT BLOBDATA FROM BTAB WHERE BLOBID = :MYBLOBID';
    $stmt = ociparse ($conn, $query);
    OCIBindByName($stmt, ':MYBLOBID', $myblobid);
    ociexecute($stmt, OCIDEFAULT);
    $arr = oci_fetch_assoc($stmt);
    // OCIFetchAssoc, OCIFetch, OCI_ASSOC ... nothing works-> Fatal error: Call to undefined function:
    $result = $arr['BLOBDATA']->load();
    What should i do?
    Thanky very much.

  • Associative array type for each blob column in the table

    i am using the code in given link
    http://www.oracle.com/technology/oramag/oracle/07-jan/o17odp.html
    i chnages that code like this
    CREATE TABLE JOBS
    JOB_ID VARCHAR2(10 BYTE),
    JOB_TITLE VARCHAR2(35 BYTE),
    MIN_SALARY NUMBER(6),
    MAX_SALARY NUMBER(6),
    JOBPIC BLOB
    CREATE OR REPLACE PACKAGE associative_array
    AS
    -- define an associative array type for each column in the jobs table
    TYPE t_job_id IS TABLE OF jobs.job_id%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_job_title IS TABLE OF jobs.job_title%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_min_salary IS TABLE OF jobs.min_salary%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_max_salary IS TABLE OF jobs.max_salary%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_jobpic IS TABLE OF jobs.jobpic%TYPE
    INDEX BY PLS_INTEGER;
    -- define the procedure that will perform the array insert
    PROCEDURE array_insert (
    p_job_id IN t_job_id,
    p_job_title IN t_job_title,
    p_min_salary IN t_min_salary,
    p_max_salary IN t_max_salary,
    p_jobpic IN t_jobpic
    END associative_array;
    CREATE OR REPLACE package body SHC_OLD.associative_array as
    -- implement the procedure that will perform the array insert
    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary in t_max_salary,
    P_JOBPIC IN T_JOBPIC
    ) is
    begin
    forall i in p_job_id.first..p_job_id.last
    insert into jobs (job_id,
    job_title,
    min_salary,
    max_salary,
    JOBPIC
    values (p_job_id(i),
    p_job_title(i),
    p_min_salary(i),
    p_max_salary(i),
    P_JOBPIC(i)
    end array_insert;
    end associative_array;
    this procedure is called from .net. from .net sending blob is posiible or not.if yes how

    Ok, that won't work...you need to generate an image tag and provide the contents of the blob column as the src for the image tag.
    If you look at my blog entry -
    http://jes.blogs.shellprompt.net/2007/05/18/apex-delivering-pages-in-3-seconds-or-less/
    and download that Whitepaper that I talk about you will find an example of how to do what you want to do. Note the majority of that whitepaper is discussing other (quite advanced) topics, but there is a small part of it that shows how to display an image stored as a blob in a table.

Maybe you are looking for

  • How to change password settings for a WLAN connect...

    Hi, I tried to connect my N95 to the office's wireless network, but I typed a wrong password. Now, every time I try to connect to the WLAN, it doesn't allow me, because the password is wrong. The password is now saved in the memory and my N95 never a

  • Certain videos give me only a black screen

    Certain videos give me only a black screen, for example all CBS News or Cnettv videos. Most videos, including, for example, NBS News videos play fine, as do the commercials before CBS News videos, but when a CBS video is supposed to start the window

  • How can I overlap two clips in final cut

      I am shooting a music video and I want the actor to appear in two spots in the same shot. I shot some test footage today and I set the camera in one spot for both shots. Shot 1 I told him to stand on the right side of the frame for awhile, cut it a

  • Basic java program wont quit

    I'm in a java class and I'm stuck on this issue. I cant figure out where I went wrong. Any help will be most welcome. I found two examples on how to do this. I used a little from both in order to make mine. The program is suppose to loop back and min

  • Error: invalid key kength

    Getting some strange occurrences: -unexpected quits more unexpected than usual -my keychain disappearing and not being able to make a new one -my drop box (shared folder) disappearing -hard crashes with FireFox and my flight sim The computer still wo