Firstly, I would like to say that I know images should really be stored in a database as a BLOB...
I am working with a system where the image has been stored in the database as a CLOB. I just have to work with what I have been given...Hence my question to SO.
Here is what I have done so far...
Query the database (using Hibernate), I can successfully obtain a single record and all of its fields. I am reading the CLOB column into a char array:
@Column(name="POD_SIGNATURE_IMG", nullable=true)
@Lob
@Basic(fetch=FetchType.LAZY)
private char[] podSignatureImage;
Next, I have assumed that in order to store the image in a CLOB, it must have been Base64 encoded. So, I convert my char array to a String:
String base64DataString = new String(podSignatureImage);
This means that I should then be able to do the following in my jsp:
<img alt="image" src="data:image/jpg;base64,${model.base64DataString}">
Except that this hasn't worked. I don't get any errors. I can see my jsp page, but I cannot see the image.
I would be very grateful for some advice.
Thank you.