- Home
- DevShare
- Forums
- Wiki
- Products & Services
- Downloads
- Documentation
- Webinars
- Store
- Blog
Back to Designing BIRT Reports FAQ
The Eclipse (BIRT) Reporting Engine (ERE) is a series of Java class files that can be deployed in any Java/J2EE environment this could be within a server based application, or a client-side application. The ERE is the runtime component of BIRT when you call it in the context of your application, you pass it a report design. The ERE then will access the data source, retrieve the data, do the required aggregations/sorting, etc., and then format the report for presentation as HTML or PDF, for example.
The BIRT report viewer is included with the report designer and is used to preview reports. It doubles as an example of how to integrate the Report Engine into a J2EE application.
See complete instructions on the BIRT Integration pages.
Take the viewer deployment from the BIRT designer (as described for Tomcat), and copy it to your JBoss deploy directory as viewer.war.
However, BIRT uses an older version of the Rhino scripting engine, and this causes a conflict with the version installed with JBoss. To work around this temporarily, put BIRT's js.jar in JBoss's server/default/lib.
See complete instructions on the Birt WebSphere Deployment page for all version's apart from 6.0.0.0 which is documented here Birt WebSphere 6.0.0.0 Deployment . Here is how to deploy BIRT 2.2 on Websphere 6.0.2.0
See complete instructions on the Birt WAS CE page.
1. Install Your JDBC Driver make an appropriate JDBC driver available to both Tomcat internal classes and to your web application. This is most easily accomplished by installing the driver's JAR file(s) into the $CATALINA_HOME/common/lib directory
That means, copy the jdbc driver jar file that you want its JNDI Data Source service to use into the <Tomcat_Home>/common\lib folder
2. Declare Your Resource Requirements
<resource-ref>
<description>Resource reference to a factory for java.sql.Connection</description>
<res-ref-name>jdbc/MySqlDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
where MySqlDB is your JNDI name
3. Configure Tomcat's Resource Factory
To configure Tomcat's resource factory, add an element like this to the /META-INF/context.xml file in the web application.
<Resource name="jdbc/MySqlDB"
auth="Container"
type="javax.sql.DataSource"
maxActive="5" maxIdle="-1" maxWait="10000"
username="acTest" password="xxx"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://birtdb2-w2k:3306/acTestDb"
description="MySQL Sfdata DB"/>
java:comp/env/jdbc/MySqlDB
webMethods Integration Server provides a Apache Tomcat package (WmTomcat) that will serve as container for Eclipse BIRT.
Integration of Eclipse BIRT into webMethods Platform involves similar steps as integration of BIRT with Tomcat. However, due to webMethods implementation of WmTomcat package and the way it interacts with Integration Server, installation steps will require additional configuration, specific to webMethods platform.
Known Issues
webMethods Integration Server 6.1
Integration Server version 6.1 by default uses older version of Tomcat 4.0 that is not compatible with Eclipse BIRT 2.1.2. Integration Server version 6.1 WmTomcat package has to be upgraded to Apache Tomcat version 5.0 by applying webMethods patch/fix: IS 6.1 SP1 Tomcat Fix 1 file name (IS_Tomcat_6-1_SP1_Fix1.zip). Newer versions of Integration Server such as 6.5 or later include a newer version of Tomcat package.
webMethods Integration Server 6.5.x - 7.x
The WmTomcat package that is installed with Integration Server version 6.5.x has Tomcat 5.0 however, package includes tools.jar file from JVM 1.4. Default installation of 6.5 uses JVM 1.5, as a result the Tomcat jsp pages will not compile correctly and BIRT will not work with this version. To work around this problem use tools.jar file provided with JVM 1.5. Copy new tools.jar file from JVM 1.5 into WmTomcat/code/jars directory and restart Integration Server.
To deploy the BIRT Viewer application inside WM IS. Follow these steps:
At this time user can create any reports using Eclipse IDE or webMethods Designer 7 tools and deploy them under webMethods Integration server.
Eclipse BIRT reports can be stored under any Integration Server package. However, it is not recommended to deploy reports under webMethods standard packages such as WmPublic or WmTomcat. It is recommended to create a custom package to host BIRT reports.
webMethods Designer 7 is Eclipse based development tool. BIRT Rerport Designer framework can be directly integrated into webMethods Designer by following same instructions for installing BIRT Report Designer on existing Eclipse installation: http://www.eclipse.org/birt/phoenix/build/#designer.
The asterisk indicates that a parameter is required. A parameter is required if:
Note that a blank value is considered to be a blank string ("") for string values, but a (database null) value (unknown) for non-string types such as numbers and dates.
Community member Stavros Kounis made an Eclipse plug-in that starts BIRT's Viewer webapp using the Eclipse internal application server and views reports inside RCP using an editor that contains a browser control. He posted it on his blog at http://tools.osmosis.gr/blog.
Also see the RCP examples located in the BIRT Wiki. http://wiki.eclipse.org/index.php/RCP_Example
Not at present, but we are looking into possible changes to support this. Also, Eclipse itself may be looking into this.
No, there is no compile step. The BIRT Report Engine directly executes the report design XML file. (This is one reason that BIRT uses interpreted JavaScript instead of compiled Java as its scripting language.)
Reports are created in two phases, Generation and Presentation. The Report Engine API has three tasks that can be used for report creation. One for generating the report, another for rendering and one that combines generation and presentation tasks. The WebViewer Example uses the combined task when generating report content using the /run servlet mapping and uses the two separate task when using the /frameset mapping. The WebViewer Example has a URL parameter __document that allows the intermediate report document to be saved for later rendering. See the Report Engine API page for more details. See the Viewer Usage page for details on the WebViewer parameters.
Setup
PHP has the ability to call Java classes. So, one integration option is to have the PHP engine call BIRT directly. Another option is to host BIRT on its own app server, such as Tomcat, and use the BIRT Viewer URLs to work with BIRT.
The first step is to install Tomcat and the BIRT viewer. Let's assume that you've set up Tomcat on the same machine as the web server running Apache, and that Tomcat listens on port 8080. Once the setup works, we're ready to focus on the PHP side.
Running a Report
Next step is to run a report from within a PHP script. Let's assume we have a report named test.rptdesign stored in C:/temp. We use a browser redirect to run the report. The redirect appears in an HTML header. Headers must be written before adding any content to the page:
$fname = "c:/temp/test.rptdesign";
// Redirect browser
$dest = "http://localhost:8080/birt-viewer/run?__report=";
$dest .= urlencode( realpath( $fname ) );
header("Location: $dest" );
The name of the report is given as an absolute path, but a relative path is also allowed once you set up the BIRT_VIEWER_REPORT_ROOT configuration variable in the BIRT viewer web app's web.xml file. Be sure to encode the file name for use in a URL.
That's all there is to it!
Passing Parameters
Suppose your report takes parameters. The test report above has one parameter called sample. We simply add them to the report URL in the form described in Using the Report Viewer.
$fname = "c:/temp/test.rptdesign";
$paramValue = "Hi there!";
// Redirect browser
$dest = "http://localhost:8080/birt-viewer/run?__report=";
$dest .= urlencode( realpath( $fname ) );
$dest .= ";sample=" . urlencode( $paramValue );
header("Location: $dest" );
The parameter value must also be encoded when placed into the URL.
Parameter Form
Ideally, we could use PHP to create a UI form that prompts for the report parameters. The BIRT viewer creates this form in Java using information in the report design. Unfortunately, at present, there is no way to retrieve the raw parameter descriptions from the BIRT viewer using a URL. Instead, there are two alternatives we can use.
First, if we know the parameters ahead of time, we can design a custom form in PHP that prompts the user for them. This works if we have a small number of reports, or if we need to create a specialized parameter page for each report anyway.
Second, we can let the BIRT viewer display the parameter page using the frameset URL.
Generating Reports Dynamically
Finally, PHP provides one additional BIRT integration option: the ability to generate report designs dynamically for a specific task. For example, suppose you have a bug tracking system, and you'd like your user to create their own reports via the web. You can ask the user for the columns to display, then use PHP to create a BIRT report design customized to display those columns. PHP is ideal for this: it allows us to insert scripting directly into HTML. Since a BIRT design is XML, and XML is close enough to HTML for PHP, we can "trick" PHP into generating a BIRT report design instead of an HTML page.
To generate a report design, do the following:
The following PHP code redirects the output of a PHP page, template.inc, into a report design called temp.rptdesign:
ob_start( );
require "template.inc";
$page = ob_get_contents( );
ob_end_clean( );
$fw = fopen( "temp.rptdesign", "w" );
fputs( $fw, $page, strlen( $page ) );
fclose( $fw );