Have any questions?
+44 1234 567 890
In this post we show you how to integrate reports generated with Eclipse Birt in ReportServer. We will create a simple report accessing ReportServer’s demo content that we set up in a previous post. We then show how to upload the report to ReportServer and execute it from there.
Eclipse Birt is an open source reporting system based on the Eclipse plattform. As JasperReports (see our post on integrating JasperReports with ReportServer) reports in Birt are defined in an XML dialect and the corresponding files usually get the extension .rptdesign. Birt comes with an easy to use report designer which is, unsurprisingly, build upon the Eclipse IDE.
Let us now generate a quick and easy report using Birt and then upload it to ReportServer. All you need for the upcoming steps is a running ReportServer instance (you can get the latest version from sourceforge) and the demo content set up.
First step, we need a copy of the Birt designer. The easiest is to download a fresh copy from the Eclipse download page. Look for “report developers” and the Birt logo. We start Eclipse in a fresh workspace and click the bent arrow to leave the welcome screen. In the project explorer we right click to create a new “Report Project”. If it is not immediately selectable, select “Other…”
Eclipse will ask whether it should switch to the Report Design perspective. It should, so click “yes”. The Report Design perspective is build up as follows. We have the Navigator with our project on the bottom left. On the top left we have the Palette and the Data Explorer. To add a new report, right click on the root folder of the newly created project and select “New -> Report”. We call the report “customer_list.rptdesign”. The view should now change to display an empty report in the main part of the window and the Palette and Data Explorer should now contain elements.
We want to create a very simple list of customer data. From the Palette we drag a “Label” to the top of the report and change it to “Customer List”. Using the properties tab in the bottom center panel you can change font size, colors etc. Next we drag a “Table” element from the Palette beneath our Label. The table should contain 4 columns. The remaining config can remain unchanged.
We now drag four labels into the header row naming them “Customer”, “Address”, “City”, and “Credit Limit”.
Next step is to define the underlying data source. For this we switch to the “Data Explorer” tab in the top left panel and create a new Data Source (right click on Data Sources). We create a “JDBC Data Source” and name it “ReportServer Demo Source”.
On the Next page we need to configure the database connection. We click on “Manage Drivers…” to add the H2 jdbc driver. Click on “Add…” and select the jar-file “h2-1.3.168.jar” from ReportServer’s WEB-INF/lib directory.
You should now have the option to select “org.h2.Driver” as Driver Class. The connection URL is the same as we used in ReportServer, that is,
jdbc:h2:PATH-TO-INTERNAL-DB/rsdemodb;FILE_LOCK=SERIALIZED
Also see our last blog for further explanation. Username and password are “demo”. We add the FILE_LOCK property to allow multiple processes to access the database files. If everything is configured correctly you should get a “Connection successful.” when hitting “Test Connection…”. Click on finish.
Next we need a Data Set. For this, create a new data set (right click on Data Sets in the Data Explorer). Leave the Data Set Type on “SQL Select Query” and name the set “Customer Data”.
We define the query as
SELECT * FROM T_AGG_CUSTOMER
Click on Finish. You will be given a list of output columns. Simply click OK. All the output columns are now available from the dataset node in the Data Explorer. We can simply drag the desired columns to the the detail cells of our table. We add “CUS_CUSTOMERNAME” to the first cell, “CUS_ADDRESSLINE1” to the second, and “CUS_CITY”, and “CUS_CREDITLIMIT” to the last two cells.
That is it. We can preview the report by switching to the Preview tab in the main window.
We can now close Eclipse. The only thing we need for the next step is the rptdesign file which we also provide here.
Adding Birt Reports to ReportServer
In the following we see how easy it is to run our just created report on ReportServer. For this, login to ReportServer and go to the report management section in the administrator’s module. Create a new Birt Report (right click on a folder and “Insert”). Name the report “Customer List” and assign the datasource that we created for demo purposes. The only step left to do is to upload the rptdesign file.
You can run the report by simply double clicking the corresponding node in the tree. You’ll see a preview of the resulting report and can export it to various format via the export options from the toolbar.
So much for the quick introduction to using Eclipse Birt with ReportServer. We will come back with more tutorials to cover more advanced topics such as multiple datasources, parameters, scripting or report libraries.