• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to download a zip file from database?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a zip file physically stored in database.
I need to read the file from database and download it .
When I tried to get the data from database using getAsciiStream and wrote it using FileWriter zip file got created but unzipping the file gives error..
I also tried unzipping the zip file but that also gave an exception

Please help!!!

Thanks in Advance

Vidhi
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use rs.getBinaryStream for reading BLOB columns.
 
vidhi sanghavi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I forgot to mention the data is stored as CLOB in database.

Thanks
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it a CLOB and not a BLOB? It's not text, is it?
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vidhi

Could you provide the full stack trace of the exception you are getting?
 
Saloon Keeper
Posts: 22505
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you attempt to present a ZIP file from a JSF view, JSF will corrupt it. Same for PDF's, Word documents, Excel spreadsheets and any other non-HTML file format. JSF is expecting to output HTML and only HTML.

Use an ordinary servlet to present the ZIP file for download. JSF is not greedy, it won't mind.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic