Have a look at the interfaces java.sql.Clob and java.sql.Blob, then have a look at the setBinaryStream(int parameterIndex, InputStream x, int length) method of java.sql.PreparedStatement class. You should be able to work it out from there.
1 - Store the path of the file in Database and then display the image using that path. It will be efficient and your database size will reasonably reduce. 2 - Store the actual image in database in the form of bytes and then read those bytes and make a file and then display that in your page. This technique is more reliable as compare to 1st because if path of the files changes or any file get deleted then there will raise problems.
Its all depends on your requirements.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com