I am trying to retrieve an image stored as a CLOB in a Derby DB via a Worklight SQL adapter. I would like to do something similar to what was written up here: https://www.
org.apache.derby.impl.jdbc.EmbedClob is a java.sql.Clob, so if you have the CLOB in a var, you should be able to get the data with:
var dataAsString = theClob.getSubString(1, theClob.length()); // Assumes all CLOBS are < 2G
Thanks for all the great information. I ended up getting this working using MySQL. The Base64 encoded image was stored in a BLOB column. To retrieve the data, my adapter SELECT statement looks like this:
selectStatement = WL.Server.createSQLStatement("select *, convert(IMAGE USING utf8) as CONVERTEDIMAGE from report");
then in my client-side code, I loop through the resultset to grab the image which I display via a Google Maps Marker in an infowindow
incidentRec.image = result.invocationResult.resultSet[i].CONVERTEDIMAGE;
$marker.click(function() {
$('#map_canvas').gmap('openInfoWindow', {'content': '<p> ' + incidentArray[this.id].description + '</br>' + '<image + src="data:image/jpg;base64,'+ incidentArray[this.id].image + '"/>' + '</p>'}, this);
});
When time permits, I can try the derby approach. Thanks again!