Chapter 4. Creating Dynamic Reports from Databases

In the previous chapter, we learned how to create our first report. The simple report in the previous chapter contained no dynamic data. In this chapter, we will explore how to create a report from the data obtained from a database.

In this chapter, we will cover the following topics:

  • How to embed SQL queries into a report template
  • How to pass rows returned by an SQL query to a report through a datasource
  • How to use report fields to display data obtained from a database
  • How to display database data in a report by using the<textField> element of the JRXML template

Note

Datasource definition

A datasource is what JasperReports uses to obtain data for generating a report. Data can be obtained from databases, ...

Get JasperReports 3.5 for Java Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.