usiness Object's Crystal Reports platform has been the industry leader for report generation and formatting for many years now. While Business Objects provides Web-based delivery platforms for Crystal, the cost-prohibitive licensing leads many businesses to settle for deploying these reports as standalone documents that require a Crystal Reports viewer. However, Crystal's Java Reporting Component (JRC) library offers a cheaper solution: deploying Crystal Reports as a component on an open source Java Web server (Tomcat, JBoss, etc.).
This article demonstrates how to implement this JRC solution within a standard Java Web application WAR. The deployed reports will provide real-time visibility into data contained within a JDBC-compliant datastore. All you need is a proficiency in Java Web development, prior experience developing reports with Crystal Reports, and a Crystal Reports version that supports the JRC.
As of the time of this writing, the JRC is available only with the following versions:
- Crystal Reports Developer X
- Crystal Reports Developer XI
- Crystal Reports Advanced Developer X
- Crystal Reports Server XI
Exploit Crystal's JRC Features to Serve Real-Time Reports
By taking the following steps, you will exploit several key JRC features that enable Crystal Reports to bind to JDBC-compliant data sources, interpret Crystal's report formats, and instantiate viewer objects for display in a Web browser via a viewer plug-in (ActiveX, DHTML, JavaBean, etc.).
First, install a Java Development Kit (1.4 or later) if you don't already have one. Next, you need a database and a compliant JDBC driver for your database. If you don't already have these, Java DB
should work fine for testing. Regardless of which database and driver you select, keep the driver handy. You'll make the driver available to Crystal later.
With the Java and database setup accomplished, you can turn your attention to Crystal. First, you need to ensure that the JRC is installed as a part of your Crystal distribution. To verify this, look for the
folder in one of the following locations:
Version 10: %INSTALL_LOCATION%\Common Files\Crystal Decisions\2.5\
Version 11: %INSTALL_LOCATION%\Business Objects\common\3.5\
By default, the installation location should be
c:\Program Files, but it may be different on your system. In the event that you do not yet have the JRC installed, launch your installation media and locate the "Add Java Components" install option.
Once the JRC is installed, you need to configure Crystal to locate your JDK and database driver. You handle this via the settings in the
file located in the
sub-folder of the
directory you just identified. Open the INI file with a text editor and locate the
section. Set the PATH to point to the
directory of your JRE (your JDK
will suffice if you do not have a separate JRE installed).
Next, make sure that the CLASSPATH variable points to the
CRDBJavaServer.jar file located in Crystal's Java bin directory (same directory as the INI file). With both of these path settings, be sure to use backslashes rather than forward slashes.
Finally, set the IORFILELOCATION variable to a temporary location such as c:\temp.
The last setup step is putting the JDBC driver JAR file identified previously in a location where Crystal can use it. Locate the
sub-folder of Crystal's
directory identified previously, and place a copy of the JAR there.