In Jaspersoft Studio, a data adapter is an XML file that connects to your data. 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 itself contains no data, the data is located in the JRDataSource.
Data adapters in Jaspersoft Studio are used to:
| • | Define the data connection type. The connection is an 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 they're easier to deploy later.
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 data adapter allows you to open a CSV (comma-separated values) 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 EJB 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.
You manage connections and data adapters through the DataAdapter Wizard. To set up a new data source, right-click Data Adapters in 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.