I was looking for a good solution to the same problem a couple of months back.
This solution may not be the best, but It was the only one I could find at the time - performance was ok using MySQL but awful on DB2 - you'll have to see for yourself.
Anyway, I used a helper
servlet to get the binary data from the DB - here's the code...
The in my jsp I have...
Hope this helps.
Regards
Dave.