A data adapter is a resource that specifies how and where to obtain data. Specifically, it is an object that contains information about how to connect to or retrieve the data, and the logic to do that. Data adapters are stored in XML files and simplify porting of the report configuration and data source creation between JasperReports environments. Whether you use a report with a data adapter XML file in Jaspersoft Studio, publish it to JasperReports Server or deploy it to a custom JasperReports environment, JasperReports Library can use it to obtain the data you specify.
This chapter starts by telling you how to create and use data adapters based on the data adapter types available in Jaspersoft Studio. Data adapters are designed to simplify the complexities of working with data in JasperReports Library. However, data adapters are only one of the ways that JasperReports Library can get data from a data source. As you get more familiar with Jaspersoft Studio, you may want to go a little deeper and learn about data in JasperReports Library and the JRDataSource interface.
Usually data adapters are stored as XML files in the same project as the report to simplify deployment to JasperReports Server or another environment. In Jaspersoft Studio, data adapters can also be stored in the Repository Explorer, in which case they are visible from all the projects. If you plan to deploy the report outside Jaspersoft Studio, it is better to store it in the project from the beginning.
This chapter has the following sections: