File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Blob to ZIP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Blob to ZIP" Watch "Blob to ZIP" New topic
Author

Blob to ZIP

m sandeep
Greenhorn

Joined: Jan 24, 2011
Posts: 17
Hi all,

I have blob data in database which is actually containing a zip file . Now i want to retrieve the blob data from DB and convert it into a zip file .
I am using postgres 8.4 data base .
By doing it normally i am not able to get to see the contents that exists in the file.
Need some suggestion
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
What is "normally"? What, exactly, is your code doing?
m sandeep
Greenhorn

Joined: Jan 24, 2011
Posts: 17
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
So what is this code doing, and how does that differ from what you were expecting?

I notice that you're ignoring the return value of the is.read method call - you can't do that: https://www.coderanch.com/how-to/java/ReadDoesntDoWhatYouThinkItDoes
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

And you should check for >= 0, not > 0. 0 is a valid return value that indicates no data is available at this moment, but there could be later on. (I've also edited that FAQ page since it also had > 0.)


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
m sandeep
Greenhorn

Joined: Jan 24, 2011
Posts: 17
Rob Spoor wrote:And you should check for >= 0, not > 0. 0 is a valid return value that indicates no data is available at this moment, but there could be later on. (I've also edited that FAQ page since it also had > 0.)
Thank you Rob and everyone for resolving the issue .It worked
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

You're welcome.
 
Consider Paul's rocket mass heater.
 
subject: Blob to ZIP