By default, when you run a report, JReport Engine fetches data from the database using the JDBC driver. For reports that are built on queries (and imported SQL files, stored procedures and UDSs which function as queries), JReport Designer enables you to create cached result files and save them somewhere in your machine. Then, when you view these reports, you can choose to use the data from the cached query result file as opposed to the database. This is very useful for working on the design of a report while you are off-line and do not have a DBMS connection. Additionally, it is helpful when you need to send data and reports to Jinfonet Support for assistance.
JReport Designer provides you with two ways to create cached query results, the first is with the Catalog Browser panel and the second is with the Resource View panel.
By setting the Data Driver property appropriately, you can make a report run using cached query result. However, for web reports, in order to make the property shown in the Report Inspector, you need to add the parameter -pd to the file JReport.bat which is located in <install_root>\bin
as follows before starting JReport Designer:
Set CLASSPATH=%REPORTHOME%\lib\SwingDesigner.jar;%REPORTHOME%\lib\report.jar;%REPORTHOME%\lib\resource.jar;%REPORTHOME%\lib\JREngine.jar;%REPORTHOME%\lib\JRResultViewer.jar;%REPORTHOME%\lib\*;%REPORTHOME%;%ADDCLASSPATH%"%JAVAHOME%\bin\java.exe" -Xms40m -Xmx512m "-Dinstall.root=%REPORTHOME%" -classpath "%CLASSPATH%" -Dreporthome="%REPORTHOME%" -Djreport.url.encoding="UTF-8" com.jinfonet.designer.JReport -pd %1 %2 %3 %4 %5 %6 %7 %8 %9
To make a page report or web report run using cached query result:
Note: This step is required for both page reports and web reports when -pd is added. For page reports when -pd is not added, ignore the step.
jrquery:/jet.universe.resultfile.UResultFileResultSet;Full path of the cached query result
For example, if the cached query result has been saved to C:\JReport\Designer\Cached
with the file name test, the property value should be jrquery:/jet.universe.resultfile.UResultFileResultSet;C:\JReport\Designer\Cached\test
Repeat the above step to set the Data Driver property for other datasets the report uses.
To make a library component run using cached query result:
The following images show where the Data Driver property is:
Image 1: without -pd
Image 2: with -pd
Note: If you check the option Use cached query result in the Catalog category of the Options dialog, whenever you view a report, a dialog will prompt you to choose a cached query result to run the report.
You may find it inconvenient to input a property value that is long and complicated. To help you with this, JReport Designer provides a tool for managing your cached query results, the Data Source Driver Manager.
Assume that a cached query result file orderstat_cached for the query OrderStat in the catalog file SampleReports.cat has been created and saved in C:\JReport\Designer\Cached
. To use the Data Source Driver Manager, follow the steps below:
jrquery:/jet.universe.resultfile.UResultFileResultSet;Full path of the cached query result
In the example, the URL is jrquery:/jet.universe.resultfile.UResultFileResultSet;C:\JReport\Designer\Cached\orderstat_cached
C:\JReport\Designer\Cached\orderstat_cached
in this example)Then, a URL will be generated according to your input information.
Upon running a report using a cached query result, you can choose an appropriate driver from the Data Driver property's drop-down list directly without inputting the long value manually.