Pentaho - Reporting Tool - Does the .prpt file (report template file) contains datasource information too?

StackOverflow https://stackoverflow.com/questions/2872079

Question

I am new Pentaho Reporting Tool. I have the following question:

When I created a report using Pentaho Report Designer, it output a report file having .prpt extension. After that I found an example on internet where the following code were used to display the report in html format:|

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
     ResourceManager manager = new ResourceManager();  
     manager.registerDefaults();  
     String reportPath = "file:" +  
     this.getServletContext().getRealPath("sampleReport.prpt");  

     try {  
         Resource res = manager.createDirectly(new URL(reportPath), MasterReport.class);  
         MasterReport report = (MasterReport) res.getResource();  
         HtmlReportUtil.createStreamHTML(report, response.getOutputStream());  
     } catch (Exception e) {  
         e.printStackTrace();  
     }  
 }  

And the report got printed successfully. So as we haven't specified any datasource information here, I think that the .prpt file contains that information in it.

If that's true than Isn't Jasper is better Reporting tool than Pentaho because when we display Jasper reports, we have to provide datasource details also so in that way our report is flexible and is not bound to any particular database.

Was it helpful?

Solution

Nope. The data source can be stored in the prpt, but it can be passed to the report too. And the usual way is to simply use JNDI so that you can deploy the same report, to multiple test/dev/production environments.

You'll probably get better quicker answers from the forum. forums.pentaho.org

OTHER TIPS

The PRPT file usually contains all information that is needed to run the report. You can provide your own datasources by modifying the MasterReport object that you get back from the ResourceManager.

However, I yet have to see valid use cases where that kind of operation actually makes sense. To provide connection information for SQL datasources at runtime you usually use the JNDI subsystem of your web-application or J2EE server.

99.99% of all reports that run on the Pentaho BI-Server do NOT have a need to manually replace datasources to run. And the remaining 0.01% are legacy reports from ancient reporting engine versions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top