• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display POI Workbook in the Rich Clien application - TWS

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic