Hi Team,
we are struck with displaying BLOB image from Oracle DB in Pentaho Report tool.


We have a BLOB field called "CONTENT" which holds the PNG image format.


Tried BSHExpression but still image is not displayed when we previewed it. Instead Object is displayed(sun.awt.image.ToolkitImage@4ccdd423)


Steps Followed:


1. Connect to the database and write a query that fetches the BLOB field. Preview it to check if the query fetches any data.
2. Right click on the "functions" header and add a new function.
3. In the dialog box for the New Function, double click on the "Scripts" and select the BHSExpression. Click "OK".
4. In the "Expression" field for the "BHSExpression", copy the following code:


Object getValue()
{
var blobObject = dataRow.get("CONTENT");
long blobLength = blobObject.length();
byte[] blobContent = blobObject.getBytes((long)1, (int)blobLength);
return Toolkit.getDefaultToolkit().createImage(blobContent);
}


5. Drag and drop the BLOB field in the canvas and map the Attribute->field to the BHSEpression.

Please provide a solution as soon as possible.
Thanks,
Kalpana