Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Saving report output in DB
Saving report output in DB [message #905648] Thu, 30 August 2012 20:03
Madhav Suram is currently offline Madhav SuramFriend
Messages: 10
Registered: August 2011
Junior Member
I saw a couple of entries in the forum including an enhancement/bug request at But didn't find any solution at the moment.

We have a requirement to generate the report and store it in a DB and download the report at a later date for viewing.

IReportRunnable design;
ByteArrayOutputStream byteStream=new ByteArrayOutputStream();

// Open report design file
InputStream designFileAsInputStream = getDesignAsStream(reportFileName);
design = birtEngine.openReportDesign(designFileAsInputStream);
// create task to run and render report
IRunAndRenderTask task = birtEngine.createRunAndRenderTask(design);	
setReportParameters(task, taskProps);

// set output options
HTMLRenderOption options = new HTMLRenderOption();			
options.setOutputFormat(format);			//HTML, PDF, PPT or XLS


Connection dbConn = getDBConn();			//Get DB connection from connection pool	
String insertReportSQL = "insert into birt.REPORTS (PRIKEY,DOC,DOCFORMAT,REPORTNAME) values(?,?,?,?,?)";
PreparedStatement st = dbConn.prepareStatement(insertReportSQL);

st.setObject(2, byteStream.toByteArray());	//REPORT
st.setString(3, format);			//Report Format
st.setString(4, reportFileName);				
rs = st.executeUpdate();


The above code works fine for PDF, PPT and XLS format reports as all images and content are in one file and we can retrieve the same too from DB. But the issue for HTML is that the images used within the report are stored in temporary location and the "byteStream", used above, only has the html content.

Is there a way to generate a mht format file instead so all images are also embedded within the document and can be saved and downloaded? Or some other way the HTML version of the report can be saved?

Thanks & Regards,

[Updated on: Thu, 30 August 2012 20:16]

Report message to a moderator

Previous Topic:BIRT 2.6.1 Rhino java script support Question
Goto Forum:

Current Time: Sat Mar 02 18:08:08 GMT 2024

Powered by FUDForum. Page generated in 0.02433 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top