In Jaspersoft Studio, a data adapter is an XML file that contains the information about where your data is located. This information includes, URL, user, password, paths, etc. Data adapters also contain the logic to prepare all parameters for JasperReports to run the query and iterate data. A data adapter does not contain any data itself, the data is located in the JRDataSource.
Data adapters in Jaspersoft Studio are used to:
| • | Define the data connection type. The connection is a SQL connection rather than a JasperReports or Jaspersoft Studio object. |
| • | Bind information to connect your data to Jaspersoft Studio. |
| • | Create the connection and necessary parameters for JasperReports library. |
Inside Jaspersoft Studio, data adapters can be stored in your Eclipse settings or in files. Files are the preferred method, because it’s easier to deploy them later.
| Jaspersoft Studio data adapters serve the same purpose as iReport's data sources. |
The most frequently used connection in Jaspersoft Studio is the JDBC data adapter. Other connection types provided by Jaspersoft Studio include:
| • | JavaBean collection data source |
| • | Spring-loaded Hibernate connection |
| • | Hadoop Hive data source |
| • | Mondrian OLAP connection |
All the connections are opened and passed directly to JasperReports during report generation. For many connections, JasperReports provides one or more built-in parameters that can be used inside the report for several purposes (for example, to fill a subreport that needs the same connection as the parent).
| • | The XML data source allows you to take data from an XML document. |
| • | A CSV (comma-separated values) data adapter allows you to open a CSV file for use in a report. |
| • | The JavaBean set data source, custom data adapter, and JRDataSourceProvider allow you to print data using purposely written Java classes. |
| • | The Hibernate connection provides the environment to execute HQL (Hibernate Query Language) queries (this connection can be configured using Spring, as well). |
| • | EJBQL (Enterprise JavaBean Query Language) queries can be used with an EJBQL connection. |
| • | MDX queries can be used with either type of OLAP client connection (native direct connection to Mondrian servers or standard XML/A providers (such as JasperReports Server or Microsoft Analysis Services) to interrogate OLAP databases. |
An empty data adapter is something like a generator of records having zero fields. Use this for testing or to meet specific needs, such as static content reports or subreports.
Connections and data adapters are managed through the DataAdapter Wizard. To set up a new data source, right-click Data Adapters from the Repository view and choose Create Data Adapter.
|
DataAdapter Wizard |
| A connection and a data adapter are different objects. However, this document uses the two terms interchangeably because their functions are so similar. |
You can set the active data adapter in several ways. The easiest and most intuitive way is to select the data adapter from the Repository view.
If no data adapter is selected, the report can't be filled, so by default Jaspersoft Studio uses a pre-configured empty data adapter. Data adapters can also be used in conjunction with the Report Wizard. But it's always better to start your report with the data you want to fill it. That’s why configuring the connection to your data is usually the first step when starting with Jaspersoft Studio.
Recommended Comments
There are no comments to display.