Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File download from Blob column does not work

 
hasina kumar
Greenhorn
Posts: 9
  • 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
  • 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
  • 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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic