This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You will be better off reading the image in from the database using rs.getBinaryStream() rather than the rs.getBytes() method.
An example might be:
This is mostly pseudo code, I haven't written one of these image servlets before, so the code isn't tested. But it shows most of the key points. I also don't know if setting the content-disposition for the images is necessary (I know it is for downloading files, so I kept it here...).
Joined: Jun 09, 2008
Using rs.getBinaryStream() worked!!! It did not seem to need the content-disposition setting.