Results 1 to 4 of 4
  1. #1
    reubenmk is offline Member
    Join Date
    Aug 2010
    Rep Power

    Default No data after downloading pdf BLOB from Oracle db


    1.I want to download a pdf file which is stored in the oracle db as a blob. But i get 0 kb file.
    I havent done this before. So pls help
    on button click a servlet calls another servlet which does the job of downloading.
    This is the code i wrote to download the file.

    protected void processRequest(HttpServletRequest request, HttpServletResponse resp)
    throws ServletException, IOException {
    try {
    OutputStream outStream = resp.getOutputStream();
    List file=(List)request.getAttribute("file");
    String fileName=null;
    byte[] fileBytes=null;
    for (int i=0;i<file.size();i++)
    Map objec=(Map) file.get(i);
    String fileType = fileName.substring(fileName.indexOf(".")+1,fileNam e.length());
    if (fileType.trim().equalsIgnoreCase("pdf"))
    resp.setContentType( "application/pdf" );

    resp.setHeader("Content-Disposition","attachment; filename=\""+fileName+"\"");
    resp.setHeader("cache-control", "must-revalidate");
    } finally {
    // out.close();

    Please tell me where i went wrong.How can i download the full pdf file with data?

    2. Lets say this pdf file is a full report of customer details.lets assume its got 300 pages. and for each customer the page no's are known. ex for customer Antony his page no in this pdf is 4 and 5. I want to only download the file with these 2 pages.How can i accomplish this task?

  2. #2
    reubenmk is offline Member
    Join Date
    Aug 2010
    Rep Power

    Default Re: No data after downloading pdf BLOB from Oracle db

    UPDATE:I solved my first problem which was very silly...just had to add the following lines


    So i finally succeeded with that. Now pls some1 help me for my second problem.I want to download pages for which page no's are known from the pdf and save as a separate pdf file. Actually thats the pdf i want to download. Not the first pdf. I just did that to learn to download a blob file.

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: No data after downloading pdf BLOB from Oracle db

    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: No data after downloading pdf BLOB from Oracle db

    Are you asking how to break up a PDF by page then?
    There are several PDF manipulation libraries out there, PDFBox and iText come to mind.
    I have no idea how successfully they would do what you need.

Similar Threads

  1. loading blob data in database
    By newbie123 in forum JDBC
    Replies: 5
    Last Post: 12-21-2011, 03:50 PM
  2. Replies: 3
    Last Post: 04-29-2010, 09:58 AM
  3. oracle data insertion
    By mudit222 in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 04-12-2010, 06:01 PM
  4. Retrieving image stored as BLOB object in oracle
    By venkateshcoolmoon in forum JDBC
    Replies: 11
    Last Post: 01-17-2010, 06:06 PM
  5. Problems updating blob columns on Oracle 9
    By ljustiniano in forum JDBC
    Replies: 0
    Last Post: 08-14-2007, 06:17 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts