iReport Ultimate Guide - Nimsoft Library
iReport Ultimate Guide - Nimsoft Library iReport Ultimate Guide - Nimsoft Library
iReport Ultimate GuideFigure 2-11Oracle Driver Loaded from an External JARResume the testing without closing iReport by copying the JDBC driver into the /lib directory and clicking Test again. iReportautomatically locates the required JAR file and loads the driver from it. In Chapter 11, I will explain the configurationmethods for various data sources in greater detail.If the test is successful, click the Save button to store the new connection.The connection will appear in the data source drop-down list in the main tool bar (Figure 2-12). Select it to make it the activeconnection.Another way to set the active connection is by opening the data source window (Figure 2-12):1. Select the Tools → Report data sources menu item (or by clicking the button on the tool bar next to the data sources dropdownlist).2. Select the data source that you want to make active:Figure 2-12Data Sources Window3. Click Set as default.The selected data source is the one used to fill the report and perform other operations, such as the acquisition of the fieldsselected through SQL queries. There is no strict binding between a report and a data source, so you can run a report withdifferent data sources, but only one at time. Later, we will see how subreports can be used to create a report that uses multipledata sources.24
Getting StartedThe Data Sources drop-down menu allows you to select the active data source; the ◄ button on the left opens the Data Sourceswindow:Figure 2-13Data Sources Drop-Down Menu2.10 Creating Your First ReportNow that you have installed and configured iReport and prepared a JDBC connection to the database, you will proceed tocreate a simple report using the Wizard.For this example and many of those following, you will use HSQLDB, a small relational database written in Java and suppliedwith a JDBC driver. You can learn more about this small jewel by visiting the HSQLDB web site.2.10.1 Using the Sample DatabaseFor sample reports, we will use the sample database that comes with JasperReports.Download JasperReports (the biggest distribution) and unpack it. Open a command prompt (or a shell) and change to the/demo/hsqldb. IIf you have Ant (and you know what it is), just run:ant runServerOtherwise, run this command (all in a single line):java -cp ..\..\lib\hsqldb-1.7.1.jar org.hsqldb.ServerThe database server will start and we will be ready to use it with iReport.2.10.2 Using the Report WizardThe table below lists the parameters you should use to connect to the sample database:ParameterNameJDBC DriverJDBC URLUsernameValueJasperReports Sampleorg.hsqldb.jdbcDriverjdbc:hsqldb:hsql://localhostsaPasswordWhen the password is blank, as in this case, remember to set the Save password check box when configuring the connection.1. Click File → Report Wizard. This loads a wizard (Figure 2-14) for the step-by-step creation of a report, starting with theselection of the template followed by the selection of the name and the location of the new report.25
- Page 1 and 2: UNIFIED REPORTER iREPORTULTIMATE GU
- Page 3 and 4: Table of ContentsTABLE OF CONTENTSC
- Page 5: Table of Contents6.1.2 Accessing th
- Page 8 and 9: iReport Ultimate GuideChapter 16 Cr
- Page 10 and 11: iReport Ultimate Guide• TrueType
- Page 12 and 13: iReport Ultimate Guide12
- Page 14 and 15: iReport Ultimate Guide• iReport-x
- Page 16 and 17: iReport Ultimate GuideFigure 2-2Bui
- Page 18 and 19: iReport Ultimate GuideFigure 2-5Win
- Page 20 and 21: iReport Ultimate GuideFigure 2-7Opt
- Page 22 and 23: iReport Ultimate GuideFigure 2-9Dat
- Page 26 and 27: iReport Ultimate GuideFigure 2-14Re
- Page 28 and 29: iReport Ultimate GuideFigure 2-17Re
- Page 30 and 31: iReport Ultimate Guide9. The last s
- Page 32 and 33: iReport Ultimate GuideWhen we are f
- Page 34 and 35: iReport Ultimate GuideCode Example
- Page 36: iReport Ultimate GuideCode Example
- Page 39 and 40: Basic Notions of iReportjava.util.D
- Page 41 and 42: Basic Notions of iReportof a date,
- Page 43 and 44: Basic Notions of iReport(new java.l
- Page 45 and 46: Report StructureCHAPTER 4REPORT STR
- Page 47 and 48: Report StructureGroup HeaderDetailG
- Page 49 and 50: Report StructureThe page margin dim
- Page 51 and 52: Report StructureFigure 4-6Result of
- Page 53 and 54: Report StructureMultiple columns ar
- Page 55 and 56: Report StructureFigure 4-11Properti
- Page 57 and 58: Report StructureAs you can see in F
- Page 59 and 60: Report Structure4.1.3.12 ImportsThe
- Page 61 and 62: Report Structureexample, in a repor
- Page 63 and 64: Report ElementsCHAPTER 5REPORT ELEM
- Page 65 and 66: Report ElementsFigure 5-3Guidelines
- Page 67 and 68: Report ElementsFigure 5-6Element no
- Page 69 and 70: Report ElementsTable 5-1Formatting
- Page 71 and 72: Report ElementsFigure 5-10Table 5-2
- Page 73 and 74: Report ElementsFigure 5-11Custom el
<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong>Figure 2-11Oracle Driver Loaded from an External JARResume the testing without closing <strong>iReport</strong> by copying the JDBC driver into the /lib directory and clicking Test again. <strong>iReport</strong>automatically locates the required JAR file and loads the driver from it. In Chapter 11, I will explain the configurationmethods for various data sources in greater detail.If the test is successful, click the Save button to store the new connection.The connection will appear in the data source drop-down list in the main tool bar (Figure 2-12). Select it to make it the activeconnection.Another way to set the active connection is by opening the data source window (Figure 2-12):1. Select the Tools → Report data sources menu item (or by clicking the button on the tool bar next to the data sources dropdownlist).2. Select the data source that you want to make active:Figure 2-12Data Sources Window3. Click Set as default.The selected data source is the one used to fill the report and perform other operations, such as the acquisition of the fieldsselected through SQL queries. There is no strict binding between a report and a data source, so you can run a report withdifferent data sources, but only one at time. Later, we will see how subreports can be used to create a report that uses multipledata sources.24