you could save filename in db and then save filecontent in specific repository(folder) in root,
it means that you could save the name of your file into DB only.
and upload file in the folder that you specify in the root for images,
when you wanna use it you should retrieve file name frim DB and image url is static from your root folder. like this jsp sample :
<img src="/images/<%= rs("ImagesField")%>" border="0"/>
if you don't wanna do like this you could save content of your image in DB that is not recomanded, you should get binary of your file and then input to DB.
attention to your code more.