Enabling Data Snapshots

The data snapshot feature was introduced in JasperReports Server release 4.7 to store report data in the server. Data snapshots create a significant change in the user experience:

Without data snapshots – Whenever users run a report, the server queries the data source and displays the latest data. When the same report is run over and over, the data source is often returning the same data each and every time. This is the behavior of all releases prior to 4.7, and the default behavior of release 4.7.
With data snapshots – The first time a report runs, it queries the data source and stores a copy of the data with the report in the repository. Users who view the report later see the data from the saved snapshot, not from querying the data source. Reports accessed through web service APIs are also based on the saved snapshot. For large reports or frequently viewed reports, the persisted snapshot provides a significant performance gain and reduces load on your data sources. Every user who has access to the report will see the data from the same snapshot. For users who require it, the report viewer provides a button to manually refresh the data snapshot anytime. In addition, when the scheduler runs a job on a report it always updates the snapshot. Data snapshots are implemented in JasperReports Server 4.7, but must be enabled manually.

Jaspersoft encourages enabling data snapshots with the following recommendations:

If you have a new installation of JasperReports Server 4.7, then enable snapshots to get the full server functionality. In the future, persistent data snapshots may be enabled by default.
If you are upgrading to release 4.7, first proceed with the upgrade procedure and verify the outcome, as instructed in the JasperReports Server Installation Guide. Then, before enabling data snapshots, notify your users about this new functionality.
Data snapshots are stored in the server’s repository, which must be sized accordingly. If you have a large number of reports, or very large reports, consider the performance of your repository database before enabling snapshots. If your users rely on data that changes frequently or if they expect to see real-time data when opening a report, do not enable snapshots. Alternatively, you can enable snapshots selectively as described below.

Global Data Snapshot Configuration

The server-level settings determines whether the snapshot feature is available or not on the server:

Data Snapshots Server-Level Configuration

Configuration File







When set to true, it allows the JasperReports Server report viewer to save data snapshots in the repository and open them the next time the report is run. By default, this is set to false.

There is also a property named snapshotRecordingEnabled that caches a snapshot in the report viewer memory when sorting and filtering columns interactively. This allows the report viewer to refresh the display without querying the database every time. Regardless of persistence, snapshotRecordingEnabled improves report viewing performance and decreases database load, and thus should remain set to true.

Report-Level Data Snapshot Configuration

At the report level, the following property can be specified to disable snapshots on a specific report by setting the following property in the report’s JRXML:


This report-level property depends on the snapshot mechanism in JasperReports Server. This property has no effect in other report viewers without such a mechanism, such as the viewer integrated in Jaspersoft iReport Designer.

There are two ways to control snapshots at the report level. In the case above:

Data snapshots are enabled on the server, so most reports use them.
If there are a few reports that do not benefit from data snapshots, those reports can explicitly disable snapshots in their own JRXML.

As with all report-level properties, you may set server-wide default values, as described in Configuring JasperReports Library:

Data Snapshots Default Report-Level Configuration

Configuration File





When set to false, the server-wide default for reports is to not use data snapshots, however, they are still available if a report overrides this value to true in its own JRXML.

Because the report-level property take precedence over the server-level property, this enables a second way to control snapshots:

Data snapshots are enabled on the server.
But the server-wide default is set to false, so most reports do not use them.
If there are a few reports that benefit from data snapshots, those reports can explicitly enable snapshots in their own JRXML with:


Data Snapshots in the Scheduler

When data snapshots are enabled on reports, the data snapshot is updated every time that a scheduled job for the report runs. Scheduled jobs always run the report by accessing the data source, and so they have up-to-the-minute data when they generate output. By default, the job updates the data snapshot with this new data after it runs. However, you can also enable a check box in the scheduler interface to update the data snapshot without producing any other report output. In this way, you can schedule a job to refresh the data snapshot periodically, whether hourly, daily, weekly, or whatever suits your data requirements.

To enable snapshot-only updating in the scheduler interface, set the following configuration:

Data Snapshots Scheduler Configuration

Configuration File





Locate the OUTPUT_FORMAT_DATA_SNAPSHOT property and uncomment it as shown:

<!-- data snapshot persistence is turned off by default -->
<!-- uncommented this now that it is turned on -->
<bean class="com.jaspersoft.jasperserver.war.dto.ByteEnum">
    <property name="code">
        <util:constant static-field="com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJob.OUTPUT_FORMAT_DATA_SNAPSHOT"/>
    <property name="labelMessage">

After restarting the server, the new check box appears when scheduling a report. When it is the only box checked, the scheduler will run the report, update the data snapshot, and not produce any output. When used with other outputs, it has no effect because the data snapshot is always updated when any other output is scheduled.

Finally, when data snapshots are enabled, you can also update them through REST web services calls. When specifying the report to run with the rest_v2/reportExecutions service, you can add arguments to explicitly update or not update the associated data snapshot. For more information, see the JasperReports Server Web Services Guide.