Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display POI Workbook in the Rich Clien application - TWS

 
Fix Berg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are moving away from Actuate. We keep data as a BLOB in the DB. I am trying to find the way to generate POI workbook from the blob and display it in the JFrame.
Any ideas?
Thank you.
 
Kenneth Rowe
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The standard solution is to do something like this:


try{

PreparedStatement ps=conn.prepareStatement("SELECT graphic_blob from graphic_table where primary_key = ?");
ps.setString(1,sTemplateKey);
ResultSet rs=ps.executeQuery();
if(rs.next()){

{
Blob b=rs.getBlob(1);
InputStream in =b.getBinaryStream();
int n=in.read();
while(n!=-1) {
out.write(n);
n=in.read();
//System.out.print("n: " + n);
}
int sheetCount = wb.getNumberOfSheets();
System.out.print( "sheetCount for createWorkbook(out): " + sheetCount);

out.flush();
out.close();
in.close();


if (theRS != null) theRS.close();
if (stmt != null) stmt.close();


}// end if for while loop

}// end of resultset fetch
}// end of try
catch (SQLException e){
String theError =e.getMessage() ;
if (theError.startsWith("Io exception")){
theError = "<b>Connection Timed Out</b><br><br>"+theError;
}
System.out.print( "connection failed because: " + theError);
out.println(sTheHeader);
h.add(helperHTML.HEADING,theError, true);
h.add(helperHTML.LINE,"", true);
h.add(helperHTML.NORMAL,sSQLString, true);
sThePage = h.getPage();
out.println(sThePage);
out.println("</body>");
out.println("</html>");
out.close();
return;

}//end of catch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic