JReport and SilverStream Application Server Integration Notes
Jinfonet Software, Inc. March, 1999 IntroductionThis note describes the integration between JReport products and SilverStream Application Server 2.0. Please note that only JReport Server 1.2 and a special version of JReport Viewer 1.2 are compatible with Microsoft Java VM and this SilverStream. Do not use JReport version 1.1.4 for this purpose. The Integration can occur in two ways: client/server and desktop. We assume that SilverStream users are using a Client/Server architecture. Therefore only the Client/Server approach is described below.
We assume that you will first use JReport Professional Designer to design the reports. Next, you install JReport Server on a computer designated as a "server" with TCP/IP connectivity and copy the entire report catalog directory to that computer. Finally, you integrate the JReport Client Viewer Bean into a SilverStream application and use JReport Server to generate the reports.
How JReport works
The JReport system is used for design, view and deploy formatted reports from data retrieved from either a JDBC or ODBC connection or from the user's application data.While using the JReport system,the first step is to design your reports by using JReport Designer. JReport Designer must run under a Java VM (Sun's JDK 1.1.7 or JDK 1.2) which supports a Java compiler to process the formulas in the report. (This is required even if you don't use formula in your report. Since Microsoft's Java VM does not provide a Java compiler, so it cannot be used to run JReport Designer. In the next release, we will provide our own formula compiler and make the JReport Designer also compatible with Microsoft Java VM.)
For the step-by-step illustration of how to install the JReport Designer, please refer to the tutorial http://www.jinfonet.com/help/lesson1.htm. After the reports being designed and tested, they are saved in the files with the extension .cls. (Optionally a source/specification file with the extension .rpt may be generated.) To see how to use JReport Designer to design a simple report, please refer to http://www.jinfonet.com/help/lesson2.htm.
The saved reports then can be deployed by using JReport Server and Viewer Bean. The report engine (JReport Server) runs on a server computer and communicates with the report viewer (Client Viewer Bean) through the HTTP protocol. You will first copy all the files in the report catalog directory to the server computer. Some of the files you will copy are:
Before the catalog and its reports can work on the server computer, you need to make sure that the database connection is properly setup. JReport Catalog Doctor packaged with JReport Server is provided for setting up the database connection inside the catalog. For how to use JReport Catalog Doctor, please refer to: http://www.jinfonet.com/help/CatDr_UserGuide.htm
JReport Client Viewer Bean is used to issue requests to JReport Server to run a particular report on the server. After running a report, JReport Server creates a result file with extension .rst. This result file will be sent to the client computer and viewed by JReport Client Viewer Bean which is integrated as a part of your SilverStream application.
How to integrate JReport Client Viewer bean into SilverStream
In order to run JReport Client Viewer bean in SilverStream, JReport Server should be loaded first. To find out how to install and run JReport Server, please refer to: http://www.jinfonet.com/help/lesson5.htm.
In the followings, we assume that you have already started JReport Server on a server computer.
Setting up the JReport Viewer Bean
Integrating JReport Client Viewer beans into SilverStream
The first step to integrate JReport Client Viewer bean into SilverStream is to load SilverStream Server and SilverStream Designer:Inside the SilverStream Designer, select a database that you want to use, click on the Media icon and the new icon at the bottom of the right part of the window and select Upload Media Object. The following Open Media File Dialog will pop up:

Note: One step client viewer bean will pop up a dialog to get the value for any parameter required for a report. Two step client viewer bean however, gives the user program the control to obtain the parameters and pass them to the bean. In the first step the bean supplies information about the parameters and in the second step the parameters are sent to the bean and the report is run. If the user program already has the parameter information, then it is possible to just use the second step calls.
Once the Jar file containing the bean has been selected, the file is analyzed and loaded into the database as a Java bean. The bean can then be accessed via the Form Designer. For this example, select OneStepJRViewer.jar.
Click the Form icon in the SilverStream Designer window, then click the New icon at the bottom to create a new form. Click Cancel when asked to select a primary table. (You can also select an existing form as the starting point.) The Form Designer window will now pop up:



JRDirectViewer.setServerName("204.177.148.110");
JRDirectViewer.setPort("8888");
JRDirectViewer.setCatName("SunVMDemo");
JRDirectViewer.setReportName("lesson3");
JRDirectViewer.setLoadReport("yes");
If ServerName, Port, CatName and ReportName have already been set in the property List (see the previous step), you only need to call JRDirectViewer.setLoadReport("yes") to run the report.
To test what we have designed so far, click Enter Test Mode button in the toolbar. In the test mode, click the button you added and you should be able to see the result of the report.

How to use JReport the html page property
Using Page Designer, you can create a html page.
In SilverStream Designer, Click the Pages icon,

then click the New icon at the bottom to create a new page. You can also select an existing page as the starting point. The Page Designer window will now pop up:
In Page Designer window, you can create a URL link which refer to JReport Server,

the URL format like this:
http://204.177.148.110:8888/jreports/tutorial/invoice.cls?catalog=Tutorial&
report=invoice&result_type=1&Submit_Btn=Submit
Note: result_type=1 means generate html format report. Detail information see the lesson5.html

To test what we have designed so far, click Show page in browser button in the toolbar. The Internet Explorer browser will be run and the html page you have been designed will be shown.

Click the URL link the html result of report will be shown.

Using SilverJRunner to access to JReport Server
You can also access to JReport Server using
SilverJRunner on a Client and Server basis.
Load SilverStream Server and SilverStream Designer, and make a form named cltviewer based
on jinfonet database in SilverStream Designer. In this form, add client viewer bean,
and set all properties needed as above(assume the JReport Server have been installed, you
can install JReport Server on any machine including the machine that installed
SilverStream),

After making a form, then install SillverJRunner to a machine, you can use this machine as client to access to SilverStream Server. Type the following command in DOS command(you can find silverjrunner.exe in bin directory under SilverStream Server's setup directory):
silverjrunner test jinfonet cltviewer
We assume test is the machine in which you installed SilverStream Server, jinfonet is the database name in SilverStream Server, cltviewer is the form name that you maked in jinfonet database.
After you run silverjrunner, you can see the following:
