Java Reference
In-Depth Information
Creating Dynamic Database
Reports
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 data obtained from a database.
In this chapter, we will cover the following topics:
How to embed SQL queries into a report definition
How to pass rows returned by an SQL query to a report via a datasource
How to use report fields to display data obtained from a database in a report
How to display data from a database in a report by using the <textField>
element of the JRXML template
Datasources: Definition
A datasource is what JasperReports uses to obtain data to
generate a report. Data can be obtained from databases, XML
files, arrays of objects, collections of objects, and XML files.
This chapter focuses on using databases as a datasource. The
next chapter discusses other types of datasources.
Database for Our Reports
In this chapter, we will use a MySQL database to obtain data for our reports.
The database is a subset of public domain data that can be downloaded from
http://dl.flightstats.us . The original download is 1.3GB. However, we deleted
most of the tables and a lot of the data to trim the download size considerably.
Search WWH ::




Custom Search