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

Similar Messages

  • BLOB download from report region in translated application does not work

    We created an application (APEX 3.1.2) with a base language dutch (300) and a translated application en-uk (3001). The problem is that in the translated application downloading BLOB's from a report region does not work and results in an error (page cannot be found).
    The query source for the region is:
    select naam
    , dbms_lob.getlength(bestand)
    , mimetype
    from bos_documentatie
    The column 'dbms_lob.getlength(filename)' is defined as a 'BLOB Download Format Mask' with the following setting:
    DOWNLOAD:BOS_DOCUMENTATIE:BESTAND:NAAM::MIMETYPE:FILENAME:::attachment:Open
    The URL's to the BLOB documents are different between the dutch and en-uk application:
    dutch:
    http://nldvnr01ux002:7792/pls/xvapexd/apex_util.get_blob?s=4260101889649158&a=300&c=12455124581749125&p=1001&k1=Application Multi Language.doc&k2=&ck=A24A5EA6903C5A9603B86D30F128F4DE&rt=CR
    en-uk:
    http://nldvnr01ux002:7792/pls/xvapexd/apex_util.get_blob?s=4260101889649158&a=300&c=12455124581749125.3001&p=1001&k1=Application Multi Language.doc&k2=&ck=7FF0C64FDD48A4D7A6892CFB2B6BCA57&rt=CR
    As you can see the c parameter for the en-uk version has a '.3001' at the end, the internal ID of the translated application. I don't know if this can be the cause of the problem?

    Hi Peter,
    Thanks for the suggestion. However we have a lot of APEX applications build in that same APEX version (one development database) and upgrading now to a higher APEX version would mean we would have to re-test all our applications and upgrade all our test and production environments, just for this bug. And, maybe the higher APEX version may not solve our problem.
    Thanks and regards,
    Patrick

  • Displaying BLOB images from table in a report

    I am trying to upload images to a table, display them in a report afterwards. I have succeeded in the first part, but not in the second.<br>
    <br>
    I can display images in a report if they are in located in wwv_flow_file_objects$ where they are automatically put after 'File browse... + Submit'. <br>
    But, if I move (insert into table + delete from ..object$) I cant display it in a report correctly. I saw the HOWTO document (the code was from there), but for some reason, it doesn't work.<br>
    <br>
    What am I doing wrong? How should I correct the column link or the procedure?<br>
    <br>
    REPORT SQL:<br>
    <br>
    id,<br>
    name,<br>
    filename,<br>
    img src="display?p_photo_id=' || nvl(id,0) || '" height="50" width="50"'<br>
    --wwv_flow_file_objects$ display<br>
    --img src="p?n=' || nvl(id,0) || '" height="50" width="50" ' img,<br>
    BLOB_CONTENT,<br>
    MIME_TYPE<br>
    from images;<br>
    PROCEDURE 'display':<br>
    create or replace procedure display (p_photo_id in number)<br>
    as<br>
    l_mime varchar2(255);<br>
    l_length number;<br>
    l_file_name varchar2(2000);<br>
    lob_loc BLOB;<br>
    begin<br>
    select mime_type, blob_content, name, dbms_lob.getlength(blob_content)<br>
    into l_mime, lob_loc, l_file_name, l_length<br>
    from images where id = p_photo_id;<br>
    owa_util.mime_header(nvl(l_mime,'application/octet'), FALSE );<br>
    htp.p('Content-length: ' || l_length);<br>
    htp.p('Content-Disposition: filename="' || l_file_name || '"');<br>
    owa_util.http_header_close;<br>
    wpg_docload.download_file( Lob_loc );<br>
    end;<br>
    <br>
    Many thanks!<br>

    Alayan - If you're using XE, that shoud be the first thing you tell us. There is a separate forum for that product.
    But as long as you're here, a couple points: you reference the "display" procedure in the img tag without qualifying it with an owner. How is the Embeded PL/SQL Gateway supposed to know what "display" is (unless you created a public synonym)? Next, in XE you need to explicitly enable access to procedures that are invoked this way. See the XE forum for discussion about that technique and read the doc here: http://download-uk.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25309/adm_wrkspc.htm#BEJCGJFJ.
    Scott

  • Maximum Download from VBAP

    Hello,
    Business has a request all the time to download data in to excel sheet from SAP so they can perform their analysis, the request is some time for couple of months of line items, and they could easily total up to 200,000 plus line items.
    But while trying to download from table VBAP 200,000 or even 150,000 we get short dumps and most of them have to break it down to 35, or 40,000 line items and then download it.
    what is the standard or the most that can be download each time from table VBAP ?
    Regards

    hmm, we have excel 2007 which also takes more than 67000k line items, but one thing i noticed is on the select spreadsheet box to choose the excel format, i only have
    Excel ( In MHTML Format)
    Excel ( In MHTMl Format for  2000/97
    Star Office 8 Calc/Openoffice.Org
    EXcel (In Office 2003 XML Format)
    SAP - Internal XML Format
    SAP Internal XLM - Format
    Excel ( In Existing XXL Format)
    and i am choose office 2003 format, how do i choose 2007 ?
    Regards

  • Downloading blob content from a custom table

    In our hosted Apex application, the following code from the Application Express Developer's Guide works great for allowing a user to download blob content from one of our custom tables via a download button. However, the code doesn't work on the Oracle Cloud because the "owa_util" package is no longer available. The code is as follows:
    CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
    v_mime VARCHAR2(48);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    Lob_loc BLOB;
    BEGIN
    SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
    INTO v_mime,lob_loc,v_file_name,v_length
    FROM file_subjects
    WHERE id = p_file;
    -- set up HTTP header
    -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
    -- set the size so the browser knows how much to download
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( Lob_loc );
    end download_my_file;
    Besides using web services, does anyone know of a way to do this? Is there a way to add access to the "owa_util" package in the cloud? I have also tried apex_util.get_blob_file_src but that is also unavailable in the Oracle Cloud.
    Thanks,
    Steve

    Following Joel's advice:
    The way I solved this was to split the code between two page processes and one application process. The download button first calls a page process to move the report data into a blob column and then calls another page process which is of "run application process" type. This calls the application level process where the download code, shown below, is called.
    Notice the following changes to the code from the one posted earlier (also from Joel)
    1) added sys.htp.init;
    2) "sys." to all htp, owa and wpg_docload calls
    3) added apex_application.stop_apex_engine; after the wpg_docload statement at the bottom of the script.
    Now the download button launches a "save as" dialog box and the report content is downloaded to the client.
    The code now looks like:
    CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
    v_mime VARCHAR2(48);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    Lob_loc BLOB;
    BEGIN
    SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
    INTO v_mime,lob_loc,v_file_name,v_length
    FROM oehr_file_subject
    WHERE id = p_file;
    -- set up HTTP header
    -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    sys.htp.init;
    sys.owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
    -- set the size so the browser knows how much to download
    sys.htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    sys. htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
    -- close the headers
    sys.owa_util.http_header_close;
    -- download the BLOB
    sys.wpg_docload.download_file( Lob_loc );
    apex_application.stop_apex_engine;
    end download_my_file;
    Thanks Joel for your help.
    Steve

  • Show a blob( pdf ) from db-table  in the clients browser/ web.show_document

    my env:
    Database R11_2 on one windows-host-machine
    AS 10 g on another windows-host-machine
    I can show files in Forms10g from inside the AS with web.show_document,
    that works fine
    but now I want to show a ( pdf or text ) File from a BLOB in a Table inside in the Database
    to the Browser running in Forms on AS,
    I do not want to create a extra Form for this reason, but want to show it in browser - windows
    ( how ) can I use web.show_document against a URL on the Database R11 ?
    what other tool , java ?
    regards

    Easiest way is probably to use mod_plsql and wpg_docload.download_file. If you retrieve the blob content from some table, than you can show it with a generic procedure like:
    procedure show_webdoc(io_blob          in out nocopy blob
                         ,i_mimetype       in varchar2
                         ,i_filename       in varchar2)
    is
    begin
       if dbms_lob.getlength(io_blob) >0 then
          owa_util.mime_header(nvl(i_mimetype,'application/octet'),false);
          htp.p('Content-length: ' || dbms_lob.getlength(io_blob));
          htp.p('Content-Disposition:  attachment; filename="'||i_filename|| '"');
          owa_util.http_header_close;
          wpg_docload.download_file(io_blob);
       end if;
    end show_webdoc;

  • How can I Insert a BLOB into a Table from Java?

    I have a Java class that creates an xml file from data in a non-sql data source. After it successfully creates and saves the file it inserts a record into an Oracle table to log the fact that an xml file was created.
    Now the guy in the warehouse wants to get an email with the file attached. I have been looking into the apex_mail package, because we already have a procedure using htmldb_mail. However, that procedure is on our old server with HTMLDB 1.6 and it is not sending any attachments.
    I think I have most of the apex_mail worked out, but I'm stuck on the blob thing. This is what I have so far:
    * The Java program creates a String object called xmlDoc
    * After xmlDoc is fully constructed, the file is written to the (Linux) server. This is accomplished with the following:
    // writing the xmlDoc
    fileDest = "/home/ewh/XMLOUT/";
    fileName = "OrderEW_"\+orderNbr\+"_"\+ticketNbr\+".xml";
    FileWriter fstream = new FileWriter(fileDest+fileName);
    BufferedWriter out = new BufferedWriter(fstream);
    out.write(xmlDoc);
    out.close();
    * Next I insert a record into the log file with:
    // Add a record to the Oracle order_email table to let the mail process know that
    // a new xml file is ready to be e-mailed to operations.
    emailLogInsertQuery = " insert into ewh.order_email ( file_name, create_date ) ";
    emailLogInsertQuery += " values ('"\+fileName\+"', sysdate)";
    oraAction = oraStmt.executeUpdate( emailLogInsertQuery );
    All of this is working fine so far. Now, I have added a blob type field to the order_email table, but I have no idea what to stick in there so that I have everything that apex_mail.add_attachment needs.
    Here's a description of the order_email table:
    SQL> desc ewh.order_email;
    Name Type Nullable Default Comments
    FILE_NAME VARCHAR2(30) Y
    FILE_BLOB BLOB Y
    CREATE_DATE DATE Y
    SEND_DATE DATE Y
    Thanks ever so much,
    Gregory
    Edited by: Canis Polaris on Jun 10, 2009 2:10 PM - Added escapes as necessary to show the plus signs around Java variables.

    Hi,
    From within APEX one can enter blob data in database tables, view the data and also update the data. Also one can send a blob attachment in an email.
    May be you can follow a combination of the following OBEs to insert BLOB data and send BLOB data from APEX:
    http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm
    http://www.oracle.com/technology/obe/apex/apex31nf/apex31email.htm
    -Priyanka

  • I can't import a table contains BLOB column  from one user to another user.

    1) I create two user both have connect role,and each has its own tablespace, DDL:
    create user d2zd identified by d2zd default tablespace d2zd quota unlimited on d2zd account unlock;
    grant connect to d2zd;
    create user d3zd identified by d3zd default tablespace d3zd quota unlimited on d3zd account unlock;
    grant connect to d3zd;
    2)Then enter oracle as d2zd and create a table contains BLOB column and insert data to the table.
    3) export d2zd as follow:
    exp d2zd/d2zd file=d2zd.dmp
    4) import to d3zd as follow:
    imp d3zd/d3zd fromuser=d2zd touser=d3zd file=d2zd.dmp
    the question is the table with BOLB colum can't be import,
    it says:have no privilege on tablespace d2zd.
    How can I import a table contains BLOB column from one user to another user?

    Hi - the reason for as our friend already told ist that a blob can be stored outside of the table segment, in another Tablespace, This is for performance reason.
    Sou you would need to have Quota on two tablespaces.
    the one which holds the table segment the other which holds the blob(segment).
    Regards
    Carl
    Message was edited by:
    kreitsch

  • 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

  • Stuck threads reading blob column from db table

    WLS 10.3.5, JDK 1.6u29, Oracle 11g RAC, ojdbc6 latest driver
    We're having problems with stuck threads trying to read a blob column from a DB table. The query to extract the blob is a simple select, without any locking such as "for update" clauses or whatever. The blob's size is <= 100k.
    The thread dump shows the following stack trace:
    +"[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE native+
    +     java.net.SocketInputStream.socketRead0(Native Method)+
    +     java.net.SocketInputStream.read(SocketInputStream.java:129)+
    +     oracle.net.ns.Packet.receive(Packet.java:300)+
    +     oracle.net.ns.DataPacket.receive(DataPacket.java:106)+
    +     oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)+
    +     oracle.net.ns.NetInputStream.read(NetInputStream.java:260)+
    +     oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:105)+
    +     oracle.jdbc.driver.T4CMAREngine.getNBytes(T4CMAREngine.java:1517)+
    +     oracle.jdbc.driver.T4C8TTILobd.unmarshalLobData(T4C8TTILobd.java:476)+
    +     oracle.jdbc.driver.T4C8TTILob.readLOBD(T4C8TTILob.java:770)+
    +     oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:361)+
    +     oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)+
    +     oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)+
    +     oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2392)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:348)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:222)+
    +     weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB.getBytes(Unknown Source)+
    +     com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback.getResult(BlobTypeHandlerCallback.java:33)+
    +     com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:52)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)+
    +     com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:282)"[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE native+
    +     java.net.SocketInputStream.socketRead0(Native Method)+
    +     java.net.SocketInputStream.read(SocketInputStream.java:129)+
    +     oracle.net.ns.Packet.receive(Packet.java:300)+
    +     oracle.net.ns.DataPacket.receive(DataPacket.java:106)+
    +     oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)+
    +     oracle.net.ns.NetInputStream.read(NetInputStream.java:260)+
    +     oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:105)+
    +     oracle.jdbc.driver.T4CMAREngine.getNBytes(T4CMAREngine.java:1517)+
    +     oracle.jdbc.driver.T4C8TTILobd.unmarshalLobData(T4C8TTILobd.java:476)+
    +     oracle.jdbc.driver.T4C8TTILob.readLOBD(T4C8TTILob.java:770)+
    +     oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:361)+
    +     oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)+
    +     oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)+
    +     oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2392)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:348)+
    +     oracle.sql.BLOB.getBytes(BLOB.java:222)+
    +     weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB.getBytes(Unknown Source)+
    +     com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback.getResult(BlobTypeHandlerCallback.java:33)+
    +     com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:52)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619)+
    +     com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)+
    +     com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)+
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)+
         com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
    +     com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)+
    +     com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)+
    +     com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:282)+
    Some threads eventually end (after 1-2 hours), most of them remain there for days.
    Any hint would be quite useful, thanks.

    Threads are executing the actual allocated request from the Weblogic Kernel. Most of the problems happen when the Thread execution is reaching the application or business layer.
    At this point your application Java code module is sending or receiving data from external sources such as a an Oracle database for example. Any problem with such external system will cause the Thread to hang and wait for data to come back.
    Other situations can occur such as internal deadlock, infinite looping, heavy IO contention on your server etc.
    Doesn't loo like a driver issue.
    http://docs.oracle.com/cd/E21764_01/doc.1111/e14770/weblogic_server_issues.htm#autoId2
    Check at the Database end
    Cheers ...

  • Regarding excel file download from webdynpro table element

    Hi All,
            I want steps to do excel download from webdynpro table element.
    Thanks in advance.
    Regards,
    Muneesh Gitta.

    Hi Gitta,
    There are 2 ways in doing it, one is using GUI DOWNLOAD FM or using class clwd_runtime_services.
    DATA:
        node_node_alv                       TYPE REF TO if_wd_context_node,
        elem_node_alv                       TYPE REF TO if_wd_context_element,
        stru_node_alv                       TYPE wd_this->element_node_alv,
        itab_node_alv                       TYPE TABLE OF wd_this->element_node_alv..
    navigate from <CONTEXT> to <NODE_ALV> via lead selection
    @TODO handle not set lead selection
      IF ( node_node_alv IS INITIAL ).
      ENDIF.
    get all declared attributes
      node_node_alv->get_static_attributes_table(
        IMPORTING
          table = itab_node_alv ).
      DATA:
        node_file_download                  TYPE REF TO if_wd_context_node,
        elem_file_download                  TYPE REF TO if_wd_context_element,
        stru_file_download                  TYPE wd_this->element_file_download ,
        item_fname                          LIKE stru_file_download-fname.
      navigate from <CONTEXT> to <FILE_DOWNLOAD> via lead selection
      node_file_download = wd_context->get_child_node( name = wd_this->wdctx_file_download ).
      get element via lead selection
      elem_file_download = node_file_download->get_element(  ).
      get single attribute
      elem_file_download->get_attribute(
        EXPORTING
          name =  `FNAME`
        IMPORTING
          value = item_fname ).
      CALL FUNCTION  'GUI_DOWNLOAD'
        EXPORTING
          filename                        = item_fname
        FILETYPE                        = 'ASC'
        TABLES
          data_tab                        = itab_node_alv.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    OR
    check this blog for
    Re: Export to Excel Sheet functionality

  • How to download values of any field having spaces from table ?

    Hi Experts,
    I have one requirement. From table but000, I have to download some values for field name1 based on partner values. The problem is the names are having spaces after it, i need to download completely including extra spaces after name.
    I have searched many threads , but coudnt find any useful information.
    i am just dowloading form edit, download options.
    Regards,
    Gaurav.

    Hello,
    In my opinion, you need to download the data as a text file. Then import it in excel. While importing you can do some settings to keep the spaces, leading zeroes etc.
    Hope this helps,
    Regards,
    Himanshu

  • 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.

  • Fetching  an image from table to be displayed in HTML

    I'm making something similar to the [online store Packaged Applications from Oracle.|http://www.oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html]
    I have small problem.
    <td rowspan="5" valign="top"><img src="f?p=&APP_ID.:30:0:#IMG#" width="50" height="50"></td>
    This is how the image is fetch from table EBA_OLS_IMAGES in the online store app. The parameter #IMG# is the id of the image, not the blob file.
    So can some one explain to me how this link works.. What the .:30:0: means.

    hi,
    So can some one explain to me how this link works.. What the .:30:0: means.please read the following link to understand deeply syntax of URL in oracle apex
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/concept.htm#BEIFCDGF
    With Regards,
    Sunil Bhatia

  • Extracting BLOB's from WWDOC_DOCUMENT

    I have a number of large audio files (MP3) in a WWDOC_DOCUMENT table. Due to several reasons my portal is currently in an unusable state. I'm not concerned with getting portal back up and running at this point but i would like to be able to retrieve the files to my filesystem. All I really want to do is come up with a simple extraction that will pull all of the BLOB's from the table. I'm thinking that I should be able to write some HTTP call or some other way to download the BLOB's to my filesystem. Any help is greatly appreciated.

    Edwin,
    Please have a look at note 113471.1 (File Upload and Download in Oracle 9iAS PL/SQL Gateway) : http://metalink.oracle.com/metalink/plsql/ml2_documents.showFrameDocument?p_database_id=NOT&p_id=113471.1
    You might be able to use the directions in this note to access the WWV_DOCUMENT$ table and retrieve the documents from the table to your filesystem.
    Hope this helps,
    Erik

Maybe you are looking for