tags: Java
, JasperReports
, J2EE
posted: Friday, April 8th, 2005
The most recent project I have been working on involved creating a large number of reports for the company’s extranet/intranet. In the past, I have usually done reports using some form of JSP and JDBC. But in this case, there is a large number of reports to be developed, and so I was tasked with researching some of the open source solutions for reporting, in hopes we could find a solution that would allow us to get the reports done faster, and be provided to the user with more functionality, and with less custom code.
In the end we compared Crystal reports with JasperReports, and JasperReports was picked. JasperReports is not only free, but also is proven in the Java world, and has a lot of users. It is customizable, since its Java and open source, and has support for using Collections or Lists of Business Objects, such as those populated via Hibernate.
Once JasperReports was chosen, I tested several GUI’s to help build the reports instead of editing them strictly in their native XML. JasperAssistant was found to be the best of all of them, and integrates seamlessly with Eclipse. If you are an Eclipse fan as I am, then you’ll love using JasperAssistant. It even allows you to preview the report against your database right in Eclipse.
Next, I looked into OpenReports. OpenReports is a front end for JasperReports. It was written in WebWork, and provides a lot of functionality that you would have to write yourself to get the reports running on the web. It comes with basic security (users, passwords, and reporting groups). You can assign which users can access which groups, and which reports are in which groups. You can also add parameters, and then assign them to a report. You create the JasperReport in JasperAssistant (or with any other tool, including a text editor if you want to do the XML by hand), and then compile it (which JasperAssistant does for you). Then when you add a new report to OpenReports, you select which JasperReport file to use, select your datasource, assign your parameters and the report is ready to be used on the web.
OpenReports allows the user to export the report as a PDF, HTML, CSV, XLS, or PNG. This is all done for you without any additional work. As for parameters, there is some good functionality built in. When you add a Date parameter to your report, it automatically brings up a calendar for the user to select the date with. Also, you can add a query parameter which runs an sql that you have specified, and populates a drop down select box with the results. Parameters can be marked as required or optional, can be several different data types, and can be told to come in in any order needed. There are other parameter options as well. It also allows the user to schedule a report and have it emailed to a user.
I have made some improvements to OpenReports, including the Collection/List functionality to use Business Objects which JasperReports supports, but OpenReports currently doesn’t. At some point I’ll pass that code on to the original developers.
In the end, with JasperReports and OpenReports, the only thing you have to worry about is creating the SQL to get the data. After that, it takes little work to provide a nice looking report in multiple formats on a web site.
Comments (275)
Leave a Comment
Pages: « 28 … 11 10 9 8 7 6 5 4 3 2 [1] Show All
There is an installation guide in the docs folder of the web application. It directs you to create the db schema using the sql provided in the database/schema directory. It then walks you through Configuring Hibernate, Creating the Admin User, Setting the Report Directory and Configuring the Scheduler.
For Configuring Hibernate, I personally choose to use a JNDI connection. You don’t have to populate any of the tables, only create them in your database.
Setup issues - you say “I found them to be very easy to install”. I have not had any success with Open Reports. I tried to follow their less-than-minimal installation guide; got to the point where I dropped the expanded web app into Tomcat, rerstarted and then… the guide does not even say what you should see or expect or the app should start up. There’s also no way to know what and how to populate and use all the tables (report_* ). Is there a more comprehensive and step-by-step guide anywhere else?
Thanks Brian,
Your opinion help me a lot. Thank again.
Would you tell me how to do the crosstab report in Jasper Reports?
Cheers,
Alex
Jasper Reports is the reporting engine. Open Reports is a web gui front end for that engine, and Hibernate is an “object/relational persistence and query service for Java”.
Jasper Reports can fill a report from a Collection of Business Objects, which were filled with data from a relational database via Hibernate. Open Reports is a web gui which allows users to select a report, enter parameters for a report, and then schedule to report to be run, or run the report in real time, and view the results in PDF, HTML, CSV, etc.
All three work together to provide a wonderful reporting solution for a Java environment. You can do without the Hibernate if you don’t need to fill the report from business objects, and just use standard JDBC to fill the reports.
Thsank for you prompted reply.
Compare with Hibernate and Open Report which one is better for a reporting server in term of performance and usability?
1. If I recall correctly, Open Report Designer did not allow filling a report with data from a Collection of business objects, which JasperAssistant did. Also, since I’m a huge fan of Eclipse, I very much enjoy having my Jasper report designer be fully integrated with Eclipse.
2. I have the open report web application as a project in Eclpse. The reports are in a reports folder in the web application. I just double click on them in Eclipse, and edit them. Then you can use deploy them however you normally would from eclipse (personally, I use the MyEclipse plugin for web app deployment).
3. Open Reports is a web appliation that should work with any application server, including WAS, Tomcat, JBoss, etc.
I’m looking for open source solution for reporting server. Your Blog already very descriptive how to perparing a reporting service.
I have feel question as follow about the development flow and system architecture. My project have 2 type of report (Adhoc, Batch)
1. JasperAssistant is it better then Open Report Designer?
2. If I use JasperAssistant create a report within my Application? How can I deploy the report to Open Report?
3. Currently I have use WAS as Application Server, Can I use JBoss & Open Report as Reporting Server?
Cheers,
Alex
I found them to be very easy to install. The learning curve is in learning how to use JasperAssistant. Not because JasperAssistant is difficult, but because you have to learn Jasper Reports and and how banding, and grouping and such works. If you happen to have Crystal experience, it won’t take as much time, but I didn’t. Installing them is trivial.
I have not used them from within Cocoon. Jasper Reports should be easy to use from within Cocoon, but I don’t think you’d be able to use Open Reports from within Cocoon. It is its own separate web application. We are keeping it separated from our intranet/extranet, and just linking to it (and integrated the security between the two). It uses WebWork as a web framework. The time to port that to Cocoon would be massive.
Good luck with setup, and let me know if you have any other questions.
Please tell me if:
(a)these packages were easy to setup
(b)you have used these tools from/within Cocoon
(c)you mind the odd question or two when I try and get them setup..?
Thanks
Pages: « 28 … 11 10 9 8 7 6 5 4 3 2 [1] Show All
RSS feed for comments on this post. TrackBack
Hi there,
I will only make 2 annotation to the previous postings …
To posting 3, about how to deploy the Reports … in OpenReports there is the possibility to upload the JasperReport-Templates (not the xml, but the precompiled templates) into the configured directory which stores the JasperReport-Files …
So if, like in my case, the “OpenReport-Server” is located on another machine, thats no problem, you can just upload the compiled reports over the OpenReports-Interface and than use them to show your Reports
.
The second is the hint to iReport … it’s a GUI for creating JasperReport-Templates too … is easy to use and nearly uptodate with the current JasperReport-Version …
It’s a standalone-java-application so that someone who don’t use eclipse could use iReport without any other software (except java of course).
It’s also possible to bind the Template at the develop-time to several DataSources like any relational database with jdbc-support, JavaBeans, xml- and csv-files and show the filled report in all the possible output-formats (pdf, html, csv, excel and in the JRViewer itself …).
So i use iReport since a while and i think thats a realy nice program to create the needed templates to use in OpenReports (or whatelse programm
.
Have a nice day …
Steffen