BackPrevious Page Next PageNext

Cached Query Results

Creating cached query results for queries

Managing cached query results

By default, when you run a report, the JReport Engine fetches data from the database using the JDBC driver. For reports that are built on queries (and also imported SQL files, stored procedures and user defined data sources), 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.

Creating cached query results for queries

JReport Designer provides you with two ways to create cached query results, the first is with the Catalog Manager and the second is with the Data panel.

Then, you can set the Data Driver property on the dataset created from the query appropriately in the Report Inspector to make a report run using cached query result.

Note: If you check the option "Use cached query result" in the Catalog category of the Options dialog, whenever you view a report in JReport Designer, a dialog will prompt you to choose a cached query result to run the report.

Managing cached query results

When specifying the Data Driver property for a dataset, you may find it inconvenient to input a property value that is long and complicated. To help you with this, JReport Designer provides data source drivers for managing your cached query results.

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 create a data source driver for the cached query result, follow the steps below:

  1. Make sure SampleReports.cat is the currently open catalog file. If not click File > Open Catalog to open it from <install_root>\Demo\Reports\SampleReports.
  2. In the Catalog Manager, click Data Source Drivers on the toolbar. The Data Source Drivers dialog appears.

    Data Source Drivers dialog

    All the added drivers will be listed in the Data Source Drivers box. If you want to remove a driver, select the driver and click the Remove button. To edit a driver, select the driver and click the Edit button.

  3. Click the New button, and the Data Source Editor appears.

    Data Source Editor

  4. Enter a name for the driver in the Driver Name box. Here, we name it OrderStat.
  5. Check the URL radio button and input the URL as follows:

    jrquery:/jet.universe.resultfile.UResultFileResultSet;Fullpath_of_cached_query_result

    In the example, the URL is jrquery:/jet.universe.resultfile.UResultFileResultSet;C:\JReport\Designer\Cached\orderstat_cached

    Note: If you check the Driver radio button to specify the driver, you will need to input the class name and parameter of the driver as follows:
    • Class Name: jet.universe.resultfile.UResultFileResultSet
    • Parameter: Full path of the cached query result (C:\JReport\Designer\Cached\orderstat_cached in this example)

    Then, a URL will be generated according to your input information.

  6. Click OK to add the driver.
  7. Click OK in the Data Source Drivers dialog to close it.
  8. Now you can choose the driver from the Data Driver property's drop-down list directly without inputting the long value manually.

BackPrevious Page Next PageNext