XML download from blob

Hi
I have a table which has blob column which is xml file. I need to extract xml file and store to local desktop.
Please help me.
Thanks
Ranga

This example generates some XML into an XMLTYPE, turns it into a BLOB and then saves it out to file...
DECLARE
   -- Data Variables
   v_xml              XMLTYPE;
   v_blob             BLOB;
   v_data_length      NUMBER;
   -- Loop Control Variables
   v_offset           NUMBER             DEFAULT 1;
   v_chunk   CONSTANT NUMBER             DEFAULT 4000;
   -- UTL_FILE variables
   fh                 UTL_FILE.file_type;
BEGIN
   -- A big query, about 27k on my PC
   SELECT XMLELEMENT ("Employees", XMLAGG (emp_dept))
     INTO v_xml
     FROM (SELECT XMLELEMENT
                     ("Employee",
                      XMLFOREST
                         (e.employee_id AS "EmployeeId",
                          e.last_name AS "Name",
                          e.job_id AS "Job",
                          e.manager_id AS "Manager",
                          e.hire_date AS "HireDate",
                          e.salary AS "Salary",
                          e.commission_pct AS "Commission",
                          XMLFOREST (d.department_id AS "DeptNo",
                                     d.department_name AS "DeptName",
                                     d.location_id AS "Location"
                                    ) AS "Dept"
                     ) emp_dept
             FROM employees e, departments d
            WHERE e.department_id = d.department_id);
   -- Turn the XML into a BLOB to bypass any 4k and 32k issues
   v_blob := v_xml.getblobval (1);
   v_data_length := DBMS_LOB.getlength (v_blob);
   -- Open the file
   fh := UTL_FILE.fopen ('XML_FILES', 'myxml.xml', 'wb', v_chunk);
   -- Da loop de loop
   LOOP
      -- Exit when our file offset is bigger than our file
      EXIT WHEN v_offset > v_data_length;
      -- Write the output chunk by chunk
      UTL_FILE.put_raw (fh, DBMS_LOB.SUBSTR (v_blob, v_chunk, v_offset),
                        TRUE);
      -- Increment the offset by the amount written
      v_offset := v_offset + v_chunk;
   END LOOP;
   -- Close the file and say byebye
   UTL_FILE.fclose (fh);
EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
      -- We won't write any data, or even open the file,
      -- if the query return no rows
      NULL;
END;This next example simply queries a CLOB from the database and saves it to file...
DECLARE
  l_file    UTL_FILE.FILE_TYPE;
  l_clob    CLOB;
  l_buffer  VARCHAR2(32767);
  l_amount  BINARY_INTEGER := 32767;
  l_pos     INTEGER := 1;
BEGIN
  SELECT col1
  INTO   l_clob
  FROM   tab1
  WHERE  rownum = 1;
  l_file := UTL_FILE.fopen('DOCUMENTS', 'Sample2.txt', 'w', 32767);
  LOOP
    DBMS_LOB.read (l_clob, l_amount, l_pos, l_buffer);
    UTL_FILE.put(l_file, l_buffer);
    l_pos := l_pos + l_amount;
  END LOOP;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.put_line(SQLERRM);
    UTL_FILE.fclose(l_file);
END;The process will always finish with a NO_DATA_FOUND exception when the end of the CLOB is reached. For simplicity I've not trapped any of the possible UTL_FILE exceptions.
For details on using UTL_FILE...
http://www.psoug.org/reference/utl_file.html

Similar Messages

  • How to retrieve xml file from BLOB and display on browser with css/xslt

    Hi All,
    I am new to xml. I am storing my xml file into BLOB in database. Now in my jsp page I want to retrieve this xml file from BLOB and display in HTML/CSS/XSLT form...
    Pl. guide me.. any docs..?? Logic...??
    Thanks in Advance.
    Sandeep Oza

    Hello Sandeep!
    I'm not familiar with jsp but logic should be as follows:
    -in jsp page instantiate XML parser
    -load specified BLOB into parser
    Now you may traverse the XML tree or you might load XSL file and use transform method to transform XML according to XSL file.
    I have an example where I'm selecting XML straight from relational database and then transform it using XSL into appropriate HTML output, but it's written in PSP.
    You can try http://www.w3schools.com/default.asp for basics on XML, CSS, XSL. It's easy to follow with good examples.
    Regards!
    miki

  • Questions regarding jsp file download from blob

    Hi developers, i'm doing jsp file download from a blob column in DB2 using struts,
    1) How do i design the jsp page such that the page will show perhaps a hyperlink for me to download the file?
    2) What about struts-config.xml? Do i need to modify any mappings there?
    It would be great if some kind developers were to provide some sample codes for me. Thanks alot. Your effort is kindly appreciated.

    http://kr.forums.oracle.com/forums/thread.jspa?threadID=1982213 - looks similar, you may need to change contentType as per use case

  • How to read a XML file from BLOB column and insert in a table - PL/SQL Only

    Hi,
    To make data load more simple to end user instead placing file on the server and use SQL-LOADER, I came up with new idea that using oracle ebusiness suite attachment functionality. that loads a XML file from local PC to a database column(table is fnd_attachments, default data type is BLOB over here).
    I tried with DBMS_LOB and didnt get around.
    Please can anyone tell me how to read the BLOB column using PL/SQL and store the data in a oracle table. Here's the sample XML file and table structure FYI.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Corporate_alloc.xsd" generated="2009-07-07T14:17:49">
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080543758</DET_CODE>
    <DET_NAME>Waves, Tides and Shallow-Water Processes</DET_NAME>
    <ALLOCATION_RATIO>0.000041</ALLOCATION_RATIO>
    </Corporate_alloc>
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080534343</DET_CODE>
    <DET_NAME>Hydrostatically Loaded Structures</DET_NAME>
    <ALLOCATION_RATIO>0.000127</ALLOCATION_RATIO>
    </Corporate_alloc>
    </dataroot>
    CREATE TABLE TEST_XML
    ( PKG_CODE VARCHAR2(50),
    PKG_NAME VARCHAR2(100),
    DET_CODE VARCHAR2(20),
    DET_NAME VARCHAR2(500),
    ALLOCATION_RATIO NUMBER )
    Thanks
    EBV

    In regards to #3, use the COLUMNS functionality of XMLTable instead of using Extract. Two simple examples are
    Re: XML Data - Caliculate fields
    Re: Extractvalue function not recognised

  • XML data from BLOB to CLOB - character set conversion

    Hi All,
    I'm trying to solve a problem with a character set conversion in PL/SQL in the following scenario:
    1. source is an XML as a BLOB variable.
    2. target is an XML as a CLOB variable.
    3. the problem I have is the following:
    - database character set is set to UTF-8
    - XML character set could be anything (UTF-8, ISO 8859-1, ISO 8859-2, ASCII, ...)
    - I need to write a procedure which converts the source BLOB content into the target CLOB taking into account the XML encoding and converts it into the DB default character set (UTF8).
    I've been able to implement a simple conversion function. However, this function expects static XML encoding ISO-8859-1. The main part of the function looks as follows:
    buffer := UTL_RAW.cast_to_varchar2(
    UTL_RAW.convert(
    DBMS_LOB.SUBSTR(source_blob_variable, 16000, pos)
    , 'American_America.UTF8'
    , 'American_America.we8iso8859p1')
    Does anyone have an idea how to rewrite the code to handle "any" XML encoding in the source BLOB file? In other words, is there a function in Oracle which converts XML character set names into Oracle character set values (ISO-8859-1 to we8iso8859p1, UTF-8 to UTF8, ...)?
    Thanks a lot for any help.
    Julius

    I want to pass a BLOB to some "createXML" procedure and get a proper XMLType in UTF8 character set, properly converted from whatever character set is the input in.As per documentation the generated XML has always the encoding set at the client side depending on NLS_LANG (default UTF-8), regardless of the input encoding, so I don't see a need to parse the PI of the XML:
    C:\>echo %NLS_LANG%
    %NLS_LANG%
    C:\>sqlplus
    SQL*Plus: Release 11.1.0.6.0 - Production on Wed Apr 30 08:54:12 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> var cur refcursor
    SQL>
    SQL> declare
      2     b   blob := utl_raw.cast_to_raw ('<a>myxml</a>');
      3  begin
      4     open :cur for select xmlroot (xmltype (utl_raw.cast_to_varchar2 (b))) xml from dual;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print cur
    XML
    <?xml version="1.0" encoding="UTF-8"?><a>myxml</a>
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    C:\>set NLS_LANG=GERMAN_GERMANY.WE8ISO8859P1
    C:\>sqlplus
    SQL*Plus: Release 11.1.0.6.0 - Production on Mi Apr 30 08:55:02 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    SQL> var cur refcursor
    SQL>
    SQL> declare
      2     b   blob := utl_raw.cast_to_raw ('<a>myxml</a>');
      3  begin
      4     open :cur for select xmlroot (xmltype (utl_raw.cast_to_varchar2 (b))) xml from dual;
      5  end;
      6  /
    PL/SQL-Prozedur erfolgreich abgeschlossen.
    SQL>
    SQL> print cur
    XML
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <a>myxml</a>

  • Issue with file download from BLOB type data

    i have been using this for a while, with no problems, including on hosted machines.
    the upload to the database works fine.. not the issue, and the download script also works fine, on the local WAMP machine.
    but once moved to the server it fails.. the query does not work.
    i have a feeling that it is something to do with the managed hosting i am using, but they say no, i have tried it on 2 seperate hosted machines (different providers), with no joy.
    if i run the select query on the hoisting server via phpmyadmin, the query runs ok.
    any suggestions as to what may be causing the problem on the server compared to the local WAMP machine?
    i really don't know where to start looking, or where to point the hosting company.
    This is the php code to download the blob data, works fine on local WAMP setup, browser asks if you want to save the file/open etc. as expected.
    <?php require_once('Connections/connTracker.php'); ?>
    <?php
    // if id is set then get the file with the id from database
    if(isset($_GET['docindex']))
               {$id    = $_GET['docindex'];
            $query = "SELECT document_name, document_type, document_size, document_content " .
               "FROM tracker_documents WHERE document_index = ".$id;
    *** seems to be failing here when running the query ***
    $result = mysql_query($query) or die('Error, query failed');
               list($name, $type, $size, $content) = mysql_fetch_array($result);
         header("Cache-Control: maxage=1"); //In seconds
       header("Pragma: public");
         header("Content-length: $size");
               header("Content-type: $type");
               header("Content-Disposition: attachment; filename=$name");
               echo html_entity_decode ($content);}
    exit;
    ?>

    Hi Gun,
    You are the only one responded to my issue. I have allocated some points.
    Yes. I have checked the assignment in CRM organizational model.
    I did download the org. structure from ECC 5.0
    All objects including sales offices are activated for determination and I have verified with green light
    As per your suggestion if the sales area data is not matched between the two systems, then how come the error will not reappear during the bdoc reprocess?
    What is missing during the first time bdoc process? Looks something is missing for validation module?
    Any inputs?
    Thanks,
    Raj

  • File Name after donwload from BLOB

    dear experts,
    i'm a newbie in programming, just started this month.. i got problem where after i download from blob (oracle) the file name will be the same as the java class that i use to download it. How can i make the file name as it real file name rather than the java class name
    For your information i use oreilly package to upload and for download i use other source code i take from internet example.

    some of the code in download java class.. i use servlet...
    public void doPost(....
    ServletOutputStream out = response.getOutputStream();
         response.setContentType(dm_file1contenttype);
         out.write(getBlob(id));
         out.flush();
         out.close();
    public byte[] getBlob(String id) {
    while (rs.next()) {
              blob = rs.getBlob(1);
              bytes = blob.getBytes(1, (int) (blob.length()));
              conn.close();

  • How to upload/download file into/from blob column in ADF/JDev 11g.

    Hello to all.
    I found demo from Kuba user on that page: http://kuba.zilp.pl/?id=1
    But that demo is for release 10g and too complicated for me for this time (I'm fish in Jdeveloper).
    I can create some simple table view (of form view) with oracle connection with table with blob data.
    Blob column will content doc/xls/pdf ...etc.
    Now I can add two buttons for download and upload.
    What I have to do in next time?
    Is it possible to use some component or something?
    Thank you
    Ben

    I was able to accomplish downloading from a blob, but I'm trying to dynamically set the ContentType.
    As the table may contain different types of files, I'm setting the ContentType to #{row.Fileext}, where Fileext is set in SQL select as follows:
    pseudocode: get file extension, and set the content type based on file extension.
    sql select :decode(substr(fdv.file_name,instr(fdv.file_name,'.',-1,1)+1),'log','text/plain; charset=utf-8','xml','text/xml','xls','application/vnd.ms-excel','tif','image/tiff','jpg','image/jpeg','unknown')
    I rather use a fuction/method, and tried the following instead:
    ContentType = #{backingBeanScope.backing_processReqs.FileAttachContType}
    where FileAttachContType =
    public class ProcessReqs {
    public String FileAttachContType() {
    // code to substring filename for extension and decode values
    return strContType
    But I get the following error:
    Error 500--Internal Server Error
              javax.el.PropertyNotFoundException: The class 'sunrider.reqpoportal.view.backing.ProcessReqs' does not have the property 'FileAttachContType'.
                   at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:547)
                   at javax.el.BeanELResolver.getValue(BeanELResolver.java:249)
                   at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
    Ideas?
    PS: Kuba, I've been trying to get to your blog all day, and it would just time out.
    Thanks everyone in advance!
    -R
    Edited by: user6631964 on Jul 24, 2009 5:55 PM

  • Getting issue while downloading 4 to 5 gb file from blob storage.

    Hi i have to download a file from blob storage upto 3 to 5 gb .
    Below is my code:
    Label lblfilename = (Label)row.FindControl("lblGrid_filename");
        Label lblfilesize = (Label)row.FindControl("lblGrid_hidfileSize");
        string downloadfile = lblfilename.Text.ToString();
       // DownloadFileFromBlob(downloadfile, CONTAINER, ACCOUNTKEY);
        AccountFileTransfer = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=" + ACCOUNTNAME + ";AccountKey=" + ACCOUNTKEY);
        if (AccountFileTransfer != null)
            BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
            ContainerFileTransfer = BlobClientFileTransfer.GetContainerReference(CONTAINER);
            ContainerFileTransfer.CreateIfNotExist();
            BlobRequestOptions options = new BlobRequestOptions();
            options.Timeout = new TimeSpan(0, 180, 0);
        var data = Regex.Match(lblfilesize.Text.ToString(), @"\d+").Value;
        int value32;
        Int64 value64;
        var blobSize = 0L;
        var blockSize = 0L;
        var offset = 0L;
        if (int.TryParse(data, out value32))
            blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        else if (Int64.TryParse(data, out value64))
            blobSize = Convert.ToInt64(lblfilesize.Text.ToString());
        var blob = ContainerFileTransfer.GetBlockBlobReference(downloadfile);
        var sasUrl = blob.Uri.AbsoluteUri;
        CloudBlockBlob blockBlob = new CloudBlockBlob(sasUrl);
        //blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        blockSize = 5 * 1024 * 1024;
        Response.Clear();
        Response.ContentType = "APPLICATION/OCTET-STREAM";
        System.String disHeader = "Attachment; Filename=\"" + blockBlob.Name + "\"";
        //Response.AppendHeader("Content-Disposition", disHeader);
        for (offset = 0; offset < blobSize; offset += blockSize)
            using (var blobStream = blockBlob.OpenRead())
                if ((offset + blockSize) > blobSize)
                    blockSize = (blobSize - offset);
                byte[] buffer = new byte[blockSize];
                blobStream.Read(buffer, 0, buffer.Length);
                Response.BinaryWrite(buffer);
                Response.Flush();
        Response.End();
    SNAPSHOT of error:
    Pawan

    Hi Will thanks per the reply
    I have make some changes in the code and now i am using the v4.0.30319 azure storage for downloading and able to download a file upto 3.5 GB. Now the problem is that each file size is showing 0 KB.
    Here is my code and snapshot:
      Button btndownloadrow = (Button)sender;
        GridViewRow row = (GridViewRow)btndownloadrow.NamingContainer;
        Label lblfilename = (Label)row.FindControl("lblGrid_filename");
        Label lblfilesize = (Label)row.FindControl("lblGrid_hidfileSize");
        string downloadfile = lblfilename.Text.ToString();
        CloudStorageAccount AccountFileTransfer = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=" + ACCOUNTNAME + ";AccountKey=" + ACCOUNTKEY);
        // Create the blob client.
        CloudBlobClient BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
        // Retrieve reference to a previously created container.
        CloudBlobContainer ContainerFileTransfer = BlobClientFileTransfer.GetContainerReference("filetransfer");
        if (AccountFileTransfer != null)
            BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
            CloudBlockBlob pageBlob = ContainerFileTransfer.GetBlockBlobReference(CONTAINER);
            ContainerFileTransfer.CreateIfNotExists();
            BlobRequestOptions options = new BlobRequestOptions();
            options.ServerTimeout= new TimeSpan(0, 180, 0);
        var data = Regex.Match(lblfilesize.Text.ToString(), @"\d+").Value;
        int value32;
        Int64 value64;
        var blobSize = 0L;
        var blockSize = 0L;
        var offset = 0L;
        if (int.TryParse(data, out value32))
            blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        else if (Int64.TryParse(data, out value64))
            blobSize = Convert.ToInt64(lblfilesize.Text.ToString());
        CloudBlockBlob blob = ContainerFileTransfer.GetBlockBlobReference(downloadfile);
        var sasUrl = blob.Uri;
        CloudBlockBlob blockBlob = new CloudBlockBlob(sasUrl);
        //blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
        blockSize = 4 * 1024 * 1024;
        Response.Clear();
        Response.ContentType = "APPLICATION/OCTET-STREAM";
        System.String disHeader = "Attachment; Filename=\"" + blockBlob.Name + "\"";
        Response.AppendHeader("Content-Disposition", disHeader);
       // blob.DownloadToStream(Response.OutputStream);
       // byte[] bytes = new byte[blockSize];
        for (offset = 0; offset < blobSize; offset += blockSize)
            using (var blobStream = blockBlob.OpenRead())
                if ((offset + blockSize) > blobSize)
                    blockSize = (blobSize - offset);
            byte[] buffer = new byte[blockSize];
                blobStream.Read(buffer, 0, buffer.Length);
                Response.BinaryWrite(buffer);
                Response.Flush();
        Response.End();
    SNAPSOT:
    Please suggest me if i am missing any logic.
    Pawan

  • How to download data in xml format from a jsp in IE

    In my program, I am trying to download xml data from jsp. The problem I am facing is that the downloaded page opens in the browser itself. I want it to open in a new page. The same code works fine with csv and pdf format.

    Hello
    I am using a link that calls a javascript function. To show the file download box, I have used setContentType and setHeader functions in the jsp. Thanks.

  • Downloading an XML file from Website through BPEL/ADAPTER

    Hi,
    I want to download an xml file from one webpage through BPEL. I am using jdeveloper 10.1.3.3 to create a BPEL process and Adapters.
    Is there anyway to download the xml file from the site through FUSION middleware.

    what do you mean download, is it a site where you click a hyperlink then down load the file.
    This is not possible as this is invoked by human intervention. SOA suite is invoked by events. If you want to perform this kind of function you would need to create a jave service to perform this.
    Is there any posibility that there is a FTP link that you could use?
    cheers
    James

  • Downloading an XML file from Website through FUSION middleware

    Hi,
    I want to download an xml file from one website through BPEL. I am using jdeveloper 10.1.3.3 to create a BPEL process and Adapters.
    How can i download the xml file from the site through FUSION middleware?

    Another option would be to write a smal Java class the uses URLConnect to connect to the URL in question and use WSIF to bind it to the BPEL process.
    Just google for sample code.
    --olaf                                                                                                                                                                                                                                                                                                                                                                                           

  • Extracting xml from BLOB and display on the Browser on the fly using xslt

    HI All,
    I am storing my xml file in BLOB in oracle database.
    Now in my java-jsp application, I want to display this xml file, by extracting from BLOB in a formatted/html way...( XSLT/CSS Style) on the fly.. means without storing it as a .xml file.
    Pl. guide me...
    Thanks in advance.
    Sandeep Oza

    First, can you get an InputStream that allows you to read the XML from the BLOB?
    If you can, then simply get a Transformer object for your XSLT, then calltransform(new StreamSource(yourInputStream), new StreamResult(resp.getOutputStream()));Since you won't be writing any HTML for this, there's no point in putting it in a JSP, either. A servlet would be more suitable.

  • BLOB download from table

    Hello everybody,
    I am newbie here and not very experienced with JSF. :)
    I have a mySQL database with different kind of data in it. My web application displays the results of a SELECT directly on the browser via a table; some of the fields contain BLOB (pdf) objects that are displayed as an alphanumeric string: my idea would be to have something like a link to download the blob instead!
    Is there a JSF solution to my problem?
    Thanks!

    This is what I did
    In my JSF page
    < h:graphicImage height="262" width="350" url="#{img.imgurl}"/>
    The call a servlet to display the BLOB image code below
    public class ImageBean {
         private String imgurl;     
         public ImageBean(String incidentid, String image_id){
         this.imgurl = "/faces/dispImage?fieldhh_inspectionid="+incidentid+"&pictures="+image_id;
         public void setImgurl( String imgurl){
              this.imgurl = imgurl;
         public String getImgurl(){
              return(imgurl);
    } // end class
    My Servlet Stuff
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import oracle.sql.BLOB;
    public class dispImage extends HttpServlet {
         ServletConfig svconfig = getServletConfig();
         Connection connection_mysql = null;
         protected void doPost(HttpServletRequest request,
                                                      HttpServletResponse response) throws ServletException, IOException {
    doGet(request,response);
    protected void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IOException {
    int t_number = 0;
    int image_number = 0;
    ServletOutputStream out = response.getOutputStream();
    t_number = Integer.parseInt(request.getParameter("fieldhh_inspectionid"));
    image_number = Integer.parseInt(request.getParameter("pictures"));
    response.setContentType("image/jpeg");
         byte[] bytes = null;
         Blob blob = null;
         ServletContext context = getServletContext();
         String mysql_driver =context.getInitParameter("jdbcDriver");
         String user = context.getInitParameter("username");
         String password = context.getInitParameter("password");
         String dbURL =context.getInitParameter("dbUrl")+"?user="+user+"&password="+password;
         try{
         Class.forName(mysql_driver);
         Statement stmt = null;
         ResultSet rset = null;
         connection_mysql = DriverManager.getConnection(dbURL);
         connection_mysql.setAutoCommit( false );
         stmt = connection_mysql.createStatement();
              String selString = "select image from images where incidentid = "+t_number+" and image_id ="+image_number;
              byte [] image;     
              rset = stmt.executeQuery(selString);
              while(rset.next()){
              blob = rset.getBlob(1);     
    bytes = blob.getBytes(1,(int)blob.length());
              out.write(bytes);
              out.flush();
              out.close();
         } // end try
         catch(Exception e){
         e.printStackTrace();
         e.getMessage();
    } // end of doGet
    public byte[] getBlob(int tfir_num, int image) {
    byte[] bytes = null;
         ServletContext context = getServletContext();
         Blob blob = null;
         try{
         Statement stmt = null;
         ResultSet rset = null;
         stmt = connection_mysql.createStatement();
         String selString = "select image from images where incidentid = "+tfir_num;
              rset = stmt.executeQuery(selString);
         while(rset.next()){
              blob = rset.getBlob(1);
    rset.close();
    bytes = blob.getBytes(1, (int)(blob.length() ));
              connection_mysql.close();
         } // end try
         catch(Exception e){
         e.printStackTrace();
         e.getMessage();
    //     System.out.println("DONE returning byte");
         return(bytes);
    }// end dispImage class

  • Download multiple XML files from SXMB_MONI and / or RWB

    Hi
    Does anyone have a clever way to download multiple inbound / outbound XML messages from either SXMB_MONI and / or RWB. For example, I send in 100 XML files to XI. These are mapped to an IDOC. I want to download all 100 source and target XML messages 'easily' versus drilling into each and using 'Download Window 1' or 'Download Window 2'.
    Any ideas are much appreciated.
    Thx
    Duncan

    Hi Jörg,
    I try to use class CL_XMS_PERSIST with method READ_MSG_ALL but I can't find the content of the Payload in EX_MESSAGE...
    Can you help me please ?
    Thank you.
    Elisabeth.

Maybe you are looking for

  • Need to design a website that loads files and creates inventory

    I work for an engineering firm that would like to make a website that on one page you can upload PDF files to directories that would be named according to the project number that the user inputs.  After that I would like another page that would be ab

  • Date search help in module pool programming in 4.6C version

    Hi Experts, How can i have input help in my module pool screen, I gave the searh help EXT_DATE in the search help parameter of that screen's field parameter. But its not showing the input help. I m facing this issue in 4.6C. Please advise Thanks Yoge

  • Reading Incumbent and Position data in SuccessionPlanning

    Hi All: I'm wondering if anyone else has experienced an issue with the SuccessionPlanning module where the organizational hierarchy can be viewed, and the position/holder names are displayed in the hierarchy view.  However, when clicking on the posit

  • Help!! recursive function call

        *   The function which build the category tree     public String categoryTree(Statement stat, boolean isMore, int id) {         if(!isMore) {             return "";         else            String sql = " select t_category_relation.category_relati

  • Loss of Speed since Firmware update this morning.

    Hi As confirmed in the .204 update thread since this morning I have lost over 5mb of downstream. Prior to the update I was syncing at between 39.02 and 38.82 Mbps downstream and around 9.6 Mbps upstream since been installed over two weeks ago. Now I,