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...).