This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to download a zip file from database?

 
vidhi sanghavi
Greenhorn
Posts: 13
  • 0
  • 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
 
E Armitage
Rancher
Posts: 989
9
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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?
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • 0
  • 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?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17622
39
Android Eclipse IDE Linux
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic