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

File download from Blob column does not work

 
hasina kumar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to download a file from a blob column in the database in my action class. I know that blob object was correclty populated in the first place by uploading a file. I can verify that by clicking the blob field in TOAD.
No matter what the size of the file is, it always downloads only 3k, and when i try to open the file, it says it cannot determine the type of the file. I am using Oc4j Application server with oracle database(9.2.0.5). I got the latest jdbc driver for this database version and put in my oc4j lib folder. My action class looks like:
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're downloading the file you need to be writing to the HttpServletResponse's OutputStream, not to a FileOutputStream.

try this code:

 
hasina kumar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Initially that was what i was doing trying to do, to write to ServletOutputStream from the response object. But i kept on getting "Writer already retrieved error", so i used FileOutputStream instead. But finally i figured out why i was getting the error while using response.getOutputStream(). So myster solved . Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic