Pre-installed Data Source Types

Pre-installed Data Source Types

The following data source types are pre-installed with JasperReports Server, but not visible by default in the UI:

Name Description




The query data sources for different types of databases let you specify a query and return a single relational table. Thus the instance of the data source in the server contains a query that limits what data can be further queried by the report or view based on it. The jdbcQueryDataSource type is a generic data source that lets you select any JDBC driver in the UI; the other data source types are instances of the jdbcQueryDataSource type where the JDBC driver is hard-coded for the specific database. In addition, the other data source types have database-specific fields that appear in the UI.

The jdbcQueryDataSource data source type appears in the UI with "Before 6.4" appended to its name.




The file data sources let you specify a system file as well as a query and return a single relational table. The jsonDataSource and remoteXmlDataSource data source types appear in the UI with "Before 6.4" appended to their name.

For information about using the file-based data sources, see the JasperReports Server Administrator Guide.








These are data sources with full domain that support domain-related features like returning JDBC metadata, creating derived tables, supporting calculated fields, domain pre-filtering, joining other data sources in a virtual data source, and full support in the Domain Designer. The xlsDataSource and xlsxDataSource types are Excel file-based custom data sources and the textDataSource is a text/CSV custom data source.

For information about using these data sources, see JasperReports Server Administrator Guide.



These data source types are deprecated. Instead, use a JDBC data source type like Cassandra, Hive, or Impala.

All of these data source types support the following:

You can use SQL queries in reports to access the data as a relational table.
You can create a Domain based on the data source, allowing you to alter the visibility and names of the fields extracted from the database or file. On the Display tab of the Domain Designer you can also specify which fields are measures.
You can create Ad Hoc views using the Domain based on the data source, allowing you to explore and interact with data from the database or file.
You can create virtual data sources that combine several data sources. You can then create a Domain based on the virtual data source to join the tables and access the joined data in Ad Hoc views and reports. You can even combine different formats, such as an XML file and MongoDB, as long as their data structures are compatible so the tables can be joined.

Enabling the Pre-installed Data Source Types

By default, the pre-installed data source types do not appear in the New Data Source dialog and must be enabled first.

To make pre-installed data source types available in the UI:

1. Open the file .../WEB-INF/applicationContext-remote-services.xml for editing.
2. Locate the element <util:set id="customDataSourcesToHide">.
3. Comment out the data source types you want to display.
4. Restart the server.

In the following example, JSON, JSON (Before 6.4), and Remote XML data source types are commented out so they appear in the drop-down menu in the New Data Source dialog:

<util:set id="customDataSourcesToHide">
    <!-- value>remoteXmlDataSource2</value> 
    <!-- value>remoteXmlDataSource</value> 
    <!-- value>jsonDataSource2</value> 
    <!-- value>jsonDataSource</value>
    <value>cassandraQueryDataSource</value> <!-- Deprecated. ...  -->
    <value>HiveDataSource</value> <!-- Deprecated. ... -->

After a data source type has been enabled in the UI, you can create an instance of that type.

To create a data source using a query example:

1. Log on as an administrator.
2. Click View > Repository, expand the folder tree, and right-click a folder to select Add Resource > Data Source from the context menu. Alternatively, you can select Create > Data Source from the main menu on any page and specify a folder location later. If you installed the sample data, the suggested folder is Data Sources. The New Data Source page appears.
3. In the Type field, select a data source that you enabled, for example JSON Data Source (Before 6.4) or Remote XML Data Source. The fields on the page change to prompt for the connection information required for your data source.

You have the option to use attributes in the values of data source parameters. See the JasperReports Server Administrator Guide for more information.

4. Fill in the required connection information and enter the query you want to use.
5. Enter a name for the data source and an optional description. The Resource ID is generated from the name you enter. If you haven't already specified a location, expand the folder tree and select the location for your data source.
6. Click Save in the dialog. The data source appears in the repository.

Understanding the Pre-installed Data Sources

The Java source for the pre-installed samples can be found online:

1. Go to the JasperReports Server Community website:

2. Click Browse Source Code and click OK for anonymous login.
3. Navigate to the pre-installed samples source code:

The JDBC query and flat file data source types each leverage an existing data adapter class in JasperReports Library. The data adapter class used depends on the data source type. For example, the JDBC query data source type uses a JDBCQueryDataSourceDefinition class, based on JdbcDataAdapterImpl, to allow the user to enter database connection information and a JDBC query in the New Data Source dialog. When a user creates or views a report or Ad Hoc view based on an implementation of this data source type, JasperReports Server creates a JasperReports data source as follows:

Builds a custom data source using the JasperReports Library JDBC Data Adapter.
JDBCQueryDataSourceService creates a JDBC connection based on the driver, URL, username, and password entered by the user.
JRJdbcQueryExecuterFactory executes the user-defined query and retrieves the metadata layer necessary for Domain support.
JDBCQueryDataSourceService creates the JasperReports data source that is used by JasperReports Library to fill the report.

In addition, the pre-installed data sources implement Domain support using the CustomDomainMetaData class.

You can find the message catalog and Spring bean definition file for each pre-installed data source type in the locations described in Files Used by a Custom Data Source Implementation. The file names are based on the data source name, for example: