Refcursor returning image (BLOB type) from database

Hi,
Process : Invoke activity takes ID as input parameter and passes it to partner link (db adapter) which executes stored proc returning a ref cursor. SQL statement in stored proc - ref cursor has a column with BLOB type.
Problem : Unable to return an image (defiined as BLOB type in database) through refcursor in BPEL.
Error : Unable to convert XSD element Column whose JDBC type is BLOB to a corresponding XML document element.
ORABPEL-11087
XSD :
<complexType name="RowSet">
<sequence>
<element name="Row" minOccurs="0" maxOccurs="unbounded" nillable="true">
<complexType>
<sequence>
<element name="Column" maxOccurs="unbounded" nillable="true">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name" type="string" use="required"/>
<attribute name="sqltype" type="string" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
Need Solution : To get an image (of BLOB type) into BPEL using ref cursor.
Please let me know if you need any more information to get it working.
Thanks and Regards,
Rakesh

Hi Rakesh,
There are some notes you might want to refer :
Note.423909.1      'java.lang.NumberFormatException' Signaled When Using Oracle LOB Family Column Types In ODI Datastores And Integration Interfaces:
     Note.423982.1      An "ORA-17410 No More Data to Read From Socket" Error Has Been Signaled From An ODI (Sunopsis) Integration Interface:
     Note.423768.1      Using Oracle Large Object (LOB) Datatype Columns In ODI Integration Interfaces:
     Note.744101.1      ORA-22835 Message Signaled When Using The OdiSqlUnload Tool In ODI:
     Note.424658.1      "ORA-00942" Message With Oracle Large Object (LOB) Datatype Fields In ODI Integration Interfaces:
     Note.423992.1      Using Oracle LONG Datatype Columns In ODI(Sunopsis):
     Note.424107.1      ODI Integration Interfaces And The Use Of Oracle Spatial Datatypes In Source And Target Datastores:
Hope this helps!
Cheers
Anirudh Pucha

Similar Messages

  • Write blob data from database to unix server

    Hi all,
    I need to send the attachment file into the mail. I have a header form in which I have implemented Download/Upload functionality using Apex user guide. When ever a user fill all the entries and submit the form then some field information along with attachment I need to send to the user.
    I mean when ever user hit the submit button it should take blob data from my custom table tmp_downlod_files and send to the user as an attachment.
    I have searched the post and got lot information but not able to get succeed.
    I have implemented java stored procedure for sending automatic mail when user is submitting the form but what I need is to take blob content from database and send as an attachment.
    1: So I need to write blob content from custom table to unix server in some location and from there I need to attach that file.
    2: the java store which I have implemented for sending automatic mail is working and one argument is attachment which I am passing null for now. So mail is working how to write the file from database to unix server and send as an attachment.
    What I did for writing file from database to unix server:
    1:
    CREATE OR REPLACE PROCEDURE trx_blob_to_file (l_header_id IN NUMBER)
    IS
    BEGIN
    FOR rec_picture IN (SELECT ID
    FROM TMP.tpx_download_files
    WHERE header_id = l_header_id
    AND mime_type LIKE ('image' || '%'))
    LOOP
    DECLARE
    l_out_file UTL_FILE.file_type;
    l_buffer RAW (32767);
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    l_blob_len INTEGER;
    p_data BLOB;
    file_name VARCHAR2 (256);
    BEGIN
    SELECT blob_content, filename
    INTO p_data, file_name
    FROM tpx_download_files
    WHERE ID = rec_picture.ID;
    l_blob_len := DBMS_LOB.getlength (p_data);
    l_out_file :=
    UTL_FILE.fopen ('/home/oracle/interfaces/out/upld',
    file_name,
    'wb',
    32767
    WHILE l_pos < l_blob_len
    LOOP
    DBMS_LOB.READ (p_data, l_amount, l_pos, l_buffer);
    IF l_buffer IS NOT NULL
    THEN
    UTL_FILE.put_raw (l_out_file, l_buffer, TRUE);
    END IF;
    l_pos := l_pos + l_amount;
    END LOOP;
    UTL_FILE.fclose (l_out_file);
    EXCEPTION
    WHEN OTHERS
    THEN
    IF UTL_FILE.is_open (l_out_file)
    THEN
    UTL_FILE.fclose (l_out_file);
    END IF;
    END;
    END LOOP;
    END;
    2: I have written a PL/SQL process and calling the above procedure on SUBMIT:
    DECLARE
    l_header_id NUMBER;
    l_filename VARCHAR2 (200);
    BEGIN
    SELECT header_id, filename
    INTO l_header_id, l_filename
    FROM tpx_download_files
    WHERE header_id = :p35_sr_header_id;
    trx_blob_to_file (l_header_id);
    END;
    But it is not writing the file from database to unix server.
    If I can get how to make working to write file from database to unix server then I will hopefully can send an attachment.
    3; I have given
    GRANT EXECUTE ON TPX_BLOB_TO_FILE TO PUBLIC.
    And
    GRANT EXECUTE ON UTL_FILE TO PUBLIC.
    Where I am doing wroung can anyone guide me or any other approach is appreciated.
    I am already late so I need soon. Please help.

    Hi all,
    I need to send the attachment file into the mail. I have a header form in which I have implemented Download/Upload functionality using Apex user guide. When ever a user fill all the entries and submit the form then some field information along with attachment I need to send to the user.
    I mean when ever user hit the submit button it should take blob data from my custom table tmp_downlod_files and send to the user as an attachment.
    I have searched the post and got lot information but not able to get succeed.
    I have implemented java stored procedure for sending automatic mail when user is submitting the form but what I need is to take blob content from database and send as an attachment.
    1: So I need to write blob content from custom table to unix server in some location and from there I need to attach that file.
    2: the java store which I have implemented for sending automatic mail is working and one argument is attachment which I am passing null for now. So mail is working how to write the file from database to unix server and send as an attachment.
    What I did for writing file from database to unix server:
    1:
    CREATE OR REPLACE PROCEDURE trx_blob_to_file (l_header_id IN NUMBER)
    IS
    BEGIN
    FOR rec_picture IN (SELECT ID
    FROM TMP.tpx_download_files
    WHERE header_id = l_header_id
    AND mime_type LIKE ('image' || '%'))
    LOOP
    DECLARE
    l_out_file UTL_FILE.file_type;
    l_buffer RAW (32767);
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    l_blob_len INTEGER;
    p_data BLOB;
    file_name VARCHAR2 (256);
    BEGIN
    SELECT blob_content, filename
    INTO p_data, file_name
    FROM tpx_download_files
    WHERE ID = rec_picture.ID;
    l_blob_len := DBMS_LOB.getlength (p_data);
    l_out_file :=
    UTL_FILE.fopen ('/home/oracle/interfaces/out/upld',
    file_name,
    'wb',
    32767
    WHILE l_pos < l_blob_len
    LOOP
    DBMS_LOB.READ (p_data, l_amount, l_pos, l_buffer);
    IF l_buffer IS NOT NULL
    THEN
    UTL_FILE.put_raw (l_out_file, l_buffer, TRUE);
    END IF;
    l_pos := l_pos + l_amount;
    END LOOP;
    UTL_FILE.fclose (l_out_file);
    EXCEPTION
    WHEN OTHERS
    THEN
    IF UTL_FILE.is_open (l_out_file)
    THEN
    UTL_FILE.fclose (l_out_file);
    END IF;
    END;
    END LOOP;
    END;
    2: I have written a PL/SQL process and calling the above procedure on SUBMIT:
    DECLARE
    l_header_id NUMBER;
    l_filename VARCHAR2 (200);
    BEGIN
    SELECT header_id, filename
    INTO l_header_id, l_filename
    FROM tpx_download_files
    WHERE header_id = :p35_sr_header_id;
    trx_blob_to_file (l_header_id);
    END;
    But it is not writing the file from database to unix server.
    If I can get how to make working to write file from database to unix server then I will hopefully can send an attachment.
    3; I have given
    GRANT EXECUTE ON TPX_BLOB_TO_FILE TO PUBLIC.
    And
    GRANT EXECUTE ON UTL_FILE TO PUBLIC.
    Where I am doing wroung can anyone guide me or any other approach is appreciated.
    I am already late so I need soon. Please help.

  • Returning an array type from a local method in Web Dynpro Java application

    Hi,
    In my project, we have a requirement to display 18 rolling months along with the year, starting from current month.
    How I am going to approach is that I will get the system date and get the current month and send the month and year value to a local method which will return 18 rolling months along with the year.
    But, when I tried to create a new method there is no option to return an array type. It was greyed out.
    So, we can not return an array type from a method from Web Dynpro for Java application?
    If so, what is the alternative and how am I going to achieve it?
    I will appreciate your help!
    Regards
    Ram

    HI
    You can create new methods in
      //@@begin others
      private ArrayList MyMethod(){
           // ** Put your code here
           return new ArrayList();
      //@@end
    Other option are create a context node with cardinality 0...n with one or more attributes, and in your method create the needed registers into this node. To read this values, you only need to read your context node.
    Best regards
    Edited by: Xavier Aranda on Dec 2, 2010 9:41 AM

  • Forms 6i - display into image item picture stored in blob type on database

    hi to all
    i searched on this forum but in don't found solution my problem.
    I created table with a column blob and i design form that insert and display image stored in database ( oracle 9i )
    i used image item type with block database based
    my version forms is
    Forms [32 Bit] Version 6.0.8.13.0 (Production)
    if i define column table like "long raw" it worked but i used blob i insert but i don't display image
    error is:
    ORA-00932: inconsistent datatypes: expected got
    thanks a lot to all
    bye

    I know, that the false forms-version (patch) gives you this errors. Try a newer patchset. For example patch 13-15 (for 9i), or 17 (10g rel. 1)

  • Download link to file saved in BLOB type in database

    Hi all,
    I have made a page where i am letting users upload a file in any format, and i'm saving it to database in BLOB datatype field of a table.
    The filetype is also saved in a different column of the table.
    Now I want to retrieve the contents back in that particular format by converting the data in BLOB type to filetype.
    And a link should be provided to download the file.
    A little help can be taken from this link which uses EJB session to do the same thing.
    [http://jdev1013.blogspot.com.au/2009/08/file-upload-and-download-in-toplink-adf.html]
    I want to do the same in ADF 11g JDeveloper using Oracle XE database connection.
    Below is the code i used to upload file data - now i want to download file data -
    public String uploadFile() {
    String amDef = "cabinet.model.AppModule";
    String config = "AppModuleLocal";
    ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
    ViewObject vo1 = am.findViewObject("XfileView1");
    Row row = vo1.createRow();
    if (uploadedFile.getFilename() != null){       
    byte[] array=new byte[(int)uploadedFile.getLength()];
    row.setAttribute("FileName", uploadedFile.getFilename());
    row.setAttribute("FileContent",createBlobDomain(uploadedFile));
    row.setAttribute("FileType", uploadedFile.getContentType());
    row.setAttribute("FileSize", uploadedFile.getLength());
    vo1.insertRow(row);
    am.getTransaction().commit();
    DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dcItteratorBindings =
    bindings.findIteratorBinding("XfileView1Iterator");
    dcItteratorBindings.refresh(1);
    Configuration.releaseRootApplicationModule(am, true);
    return "added";
    private BlobDomain createBlobDomain(UploadedFile file)
    // init the internal variables
    InputStream in = null;
    BlobDomain blobDomain = null;
    OutputStream out = null;
    try
    // Get the input stream representing the data from the client
    in = file.getInputStream();
    // create the BlobDomain datatype to store the data in the db
    blobDomain = new BlobDomain();
    // get the outputStream for hte BlobDomain
    out = blobDomain.getBinaryOutputStream();
    IOUtils.copy(in, out);
    catch (IOException e)
    e.printStackTrace();
    catch (SQLException e)
    e.fillInStackTrace();
    // return the filled BlobDomain
    return blobDomain;
    Thanks
    Cheena Malhotra

    Check my 3 part blog about this. This should cover your needs. http://wp.me/pcBZk-aU
    Timo

  • Display image in flex from database

    I am using flex and java and mysql,
    I upload image file into database from flex application.Now i want to display image in my flex
    RIA application from database.
    How can i do that??
    Thanks in advance!!!

    "B.O.H.R." <[email protected]> wrote in
    message
    news:g91dr3$b0f$[email protected]..
    >
    quote:
    > Ordinary Flex can't do this. You could probably do it in
    AIR. There's a
    > separate forum just for AIR applications.
    >
    >
    > Could you precise which things flex CAN'T ?:
    >
    > 1. load image file from local disk and represent it as
    an object in Flex
    > app?
    > 2. display image represented as object(created as above)
    in Flex app?
    > 3. transfer that object back and forth to database using
    BlazeDS ?
    >
    > Maybe there are posibilitie to make workaround of some
    inconviniences?
    > I am asking becaouse I realy would like to create such
    app in Flex.
    Flex can create an AIR application.
    But a swf file can't read from the local drive.
    HTH;
    Amy

  • How to display an image of BLOB type from a Table in an OAF page?

    Hi,
    My requirement is that in the database table images gets saved of type BLOB and i have to display these images in my OAF page .I looked in OA developers guide and followed the instruction but unable to achieve my requirement .As per the developers guide "I created an item of type messageDownload ,in the viewattribute i set the view attribute FileData and File View Attribute FileContentType the table used is FND_LOBS" but i couldn't achieve anything.
    Please help me and if possible give me exact way to achieve it as i am new to this framework.
    Thanks in advance

    Map the database table columns to the Table region columns. For image column set the item style as "Messagedownload". Set the View Instance (VO) , View Attibute Name (image name) and View Attribute Data (blob col).

  • ADF How to Download BLOB File from Database Column

    Hi,
    We have one blob Database Column in which we use for storing attachments(eg Image,.doc or.zip) . We are able to upload attachments.
    How can I build page which will access that particular record and will be able to download attachment in it.
    It should prompt to Save and then we can save it on Local machine.
    Thanks,
    Jit

    Sorry, I don't get your question.
    If you have a file name including the suffix like 'Test.file.doc' you can pass this file name as parameter to the method and get the MIME type back. I your sample it would be "application/msword"
    String mime = ContentTypes.get("Test.file.doc");
    public class ContentTypes
        public static String get(String fileName)
            String mime = null;
            String ext = fileName.toLowerCase();
            if (ext.endsWith(".pdf"))
                mime = "application/pdf";
            else if (ext.endsWith(".doc"))
                mime = "application/msword";
            else if (ext.endsWith(".xls"))
                mime = "application/msexcel";
            else if (ext.endsWith(".docx"))
                mime = "application/msword2007";
            else if (ext.endsWith(".xlsx"))
                mime = "application/msexcel2007";
            else if (ext.endsWith(".ppt"))
                mime = "application/vnd.ms-powerpoint";
            else if (ext.endsWith(".rar"))
                mime = "application/octet-stream";
            else if (ext.endsWith(".zip"))
                mime = "application/zip";
            else if (ext.endsWith(".jpg"))
                mime = "image/jpeg";
            else if (ext.endsWith(".jpeg"))
                mime = "image/jpeg";
            else if (ext.endsWith(".gif"))
                mime = "image/gif";
            else if (ext.endsWith(".png"))
                mime = "image/png";
            return mime;
    }Timo

  • Image on jsp from database along with other elements on image.

    Hi All,
    I wish to display an image which is stored in my database along with other contents on the page.
    I am able to display the image on an entirely new page but I do not wish to display it on a new page. Neither frames etc fit on my current page design.
    Kindly help

    I have a jsp page ..
    I have a byte stream in which i have stored the image from the database (the image is stored in databse as blob) in that jsp.When i use output stream object to display the image from the database (as suggested by many in this forum), the image is displayed in a new page. I wish to display the image along with my other elements like text etc in the same page.

  • ResultSet.getString(String) doesn't return the right text from database

    Hi everybody,
    I'm trying to read some text in Portuguese from a MS-Access database, but the special characters for Portuguese aren't correctly translated by ResultSet.getString(String).
    Here's my piece of code:
    private static void fetchEquipamentoEstabelecimento()
    try
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(
    " SELECT Eqp.NumSerie, Eqp.Estabelecimento, Estab.Nome, Estab.Cidade, Eqp.Data, Eqp.LPN " +
    " FROM Equipamento Eqp, Estabelecimento Estab " +
    " WHERE TabPreco = 23 " +
              " AND Eqp.Estabelecimento = Estab.Estabelecimento " +
    "ORDER BY NumSerie DESC");
    while(rs.next())
    String nome = rs.getString("Nome");
    System.out.println(rs.getLong("NumSerie")      + " " +
                             rs.getDate("Data")           + " " +
                             rs.getString("LPN")           + " " +
                             nome                              + " " +
                             rs.getString("Cidade"));
    stmt.close();
    catch(SQLException ex)
    printSQLException("fetchEquipamentoEstabelecimento()", ex);
    The output of this piece of code is 1 record joined from tables Equipamento and Estabelecimento:
    111222333 2001-12-15 JHK Pal<X>cio Cristal Guarda
    where the <X> is the greek letter beta. I was expecting a
    portuguese character which is an a with an accent: � (I hope the character was correctly displayed for you)
    I tried replacing
    String nome = rs.getString("Nome");
    with
    String nome = new String(rs.getString("Nome").getBytes(),codepage);
    with codepage="Cp860" (MS-DOS Portuguese)
    and codepage="Cp037" (USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia)
    but other strange characters were displayed instead of the a with an accent.
    In the MS-Access table Estabelecimento, the column Nome has a Data Type of Text.
    I'm using:
    - JDK 1.2.2
    - MS Access 2000 (in Windows 2000)
    MS Access 97 (in Windows NT 4.0).
    Any help is deeply apreciated.

    Hi!
    When you establish connection to database, try explicitly give instructions about what encoding use your DB, e.g.:
    // connection properties
    Properties connInfo = new Properties();
    connInfo.put("user", username);
    connInfo.put("password", password);
    connInfo.put("charSet", "Cp1251"); // enter your codepage!!!
    // getconnection
    Connection db = DriverManager.getConnection(dataurl, connInfo);

  • Is it possible to return an operator-type from a function/decode ?

    Hi ,
    I have a query that is calling a decode and based on the operator type (i.e <> , >= , <= etc ..) that it returns to compare 2 fields of a table
    is this possible and if so could anyone advise me how to ?
    below is my current declaration that gives invalid relational operator error
    SELECT 1 into TmpCnt FROM Tbl1a where
    a.id = ID and a.part = PART and a.parmn = TESTNAME
    and a.paval DECODE(TESTCONDITION , 'LT' , '<' ,
    'LE' , '<=' ,
    'EQ' , '=' ,
    'GE' , '>=' ,
    'GT' , '>' ,
    'NE' , '<>' ) TPARAMVALUE ';
    tks & rdgs

    You can't replace an operator with an expression.
    For a limited number of operators you may be able to code this explicitly, something like...
    SELECT 1
    FROM   tbl1a
    WHERE  a.ID = ID
    AND    a.part = part
    AND    a.parmn = testname
    AND    DECODE (testcondition,
             'LT', CASE WHEN a.paval <= tparamvalue THEN 'Y' END,
             'LE', CASE WHEN a.paval = tparamvalue THEN 'Y' END,
             'EQ', CASE WHEN a.paval >= tparamvalue THEN 'Y' END,
             'GE', CASE WHEN a.paval >= tparamvalue THEN 'Y' END,
             'GT', CASE WHEN a.paval > tparamvalue THEN 'Y' END,
             'NE', CASE WHEN a.paval != tparamvalue THEN 'Y' END) = 'Y'Otherwise you are looking at Dynamic SQL.

  • How to update image with data from database?

    hi,
    is it possible to update an image object which serves as template with some data from a database table like user name etc. by converting it to image bytes and how? The final image would show user name as part of the image

    anybody?

  • Retrieving Image Data Type from SQL Server 2000

    I'm trying to retrieve an Image using getBinaryStream() like descripbed in below code and encounter an error :
    java.lang.ClassCastException: com.microsoft.jdbc.base.BaseInputStreamWrapper
    What've I done wrong? Please help
    if(rs.next()){
                        fisAssyChart = (FileInputStream)rs.getBinaryStream("file_assembly_chat");
                        fisPPO = (FileInputStream)rs.getBinaryStream("file_ppo");
                        filePPO = new File(rs.getString("nama_file_ppo"));                    
                        fileAssyChart = new File(rs.getString("nama_file_assembly_chat"));                                                            
                   }Thx in advance
    David

    Oracle Migration Workbench:
    http://www.oracle.com/technology/tech/migration/workbench/index.html
    Cheers, OTN

  • Display Images from Database

    Hi all,
    I require to display images stored in database along with textual description of it on a JSP.
    The image file should not be stored intermediately on file system (i.e w/o using img HTML tag)
    It is a typical shopping cart appln. where images are fetched from database and the associated description is displayed along side.
    Please note that it is the case of Mixed content types(text and binary data).
    Thanks and Regards

    Like "Breakfast" said, you can do this with a servlet that retrieves your images from a database....
    if you create a servlet to do this, you would have a generic servlet which retrieves a picture from a database based upon a key which could be a picture name or number.
    Lets say the file is out there in the database as a BLOB or Binary Image... you could have this kind of code in the doPost(HttpRequest req, HttpResponse res) or doService(HttpRequest req, HttpResponse res) method.
    The table holding the image has at least two columns one called IMAGE which holds the binary image and the other called FILENAME. If the connection to the DB is already open, you do something like this.
    String fileToGet = (String)req.getParameter("FILENAME");
    rs = conn.createStatement().executeQuery("select from IMAGE_TABLE where FILENAME='" + fileToGet + "'");
    if(rs.next())
    InputStream in = rs.getBinaryStream("IMAGE");
    res.setContentType("image/jpg"); // or whatever type of file it is.
    ServletOutputStream sout = res.getOutputStream();
    int c;
    while((c = in.read()) != -1)
    sout.write(c);
    in.close();
    sout.close();
    This should write your image to the response output of the servlet.
    Now, where you want your image, you put.
    <img src="/servlet/ImageServlet?FILENAME="thefileIwant">
    This should do what you want... Use your favorite pipe copy method to get the input stream to the output stream. If you are worried about overhead and scaling like "breakfast" said (it CAN be a problem in high access sites), then you can add an image caching scheme and get really complex.... But this is a rough idea on what to do.
    Hope this helps.
    Stephen McConnell

  • How to migrate SQL Server image data type to Oracle 8 BLOB data type?

    Hi,
    I have to migrate data from sql server to Oracle 10 g.
    I am unable to migrate image data type from sql server to blob data type in oracle.
    Iam using Oracle Heterogenous Services to migrate the data,Using Merge statement and database link.
    I am getting the following error-
    ERROR at line 7:
    ORA-00932: inconsistent datatypes: expected BLOB got LONG BINARY
    Can any one suggest me how to migrate Image datatype to BLOB???

    Hi you might want to post your question in General Forum.
    General Database Discussions
    There's very few users visit this forum.

Maybe you are looking for

  • Insert into blob column from form6i

    Dear all, I have a question.... I need to develop an application with form6i which gets the filename and path from user and inserts the content of the file in a table with blob column... the files may be in any format...How can I do it in oracle form

  • Step by step approach to develope the java card application

    Do anybody know how to develope a smart card application using java card.i have downloaded java card kit,but the documentation provided by the sun is bit complex to use. so please anybody know how to proceed? It would be appreciated if i am given a s

  • Adobe Forms Object Creation in PDF document dynamically

    I have the following scenario: I have database of questions and answers, i need to build a webdynpro application that generates a PDF document with the content of this database, but in a dynamically way, for example i have one question like "What is

  • XSAN No Controller

    Hi, My xsan shows no controller. Even I am unable to connect to Xsan. Even I the permission to Remove a computer is Grey But when I open from terminal using cvadmin it shows the controller. Can I add the previous controller again as its not showing i

  • Licensing Error 213:11

    I downloaded a trial version of Photoshop Elements 11 and when I start the program, upon clicking the 'Photo editor' button, I get a licensing error message with number 213:11. When I click the 'Organizer' button, the program closes. I have a very ol