2 min read

Creating different types of reports inside the NetBeans IDE

The first step is to download the NetBeans IDE and the iReport plugin for this. The iReport plugin for NetBeans is available for free download at the following locations: https://sourceforge.net/projects/ireport/files or http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=4425

After downloading the plugin, follow the listed steps to install the plugin in NetBeans:

  1. Start the NetBeans IDE.
  2. Go to Tools | Plugins.
  3. Select the Downloaded tab.
  4. Press Add Plugins….
  5. iReport 3.7

  6. Select the plugin files. For iReport 3.7.0 the plugins are: iReport-3.7.0.nbm, jasperreports-components-plugin-3.7.0.nbm, jasperreportsextensions-plugin-3.7.0.nbm, and jasperserver-plugin-3.7.0.nbm. After opening the plugin files you will see the following screen:
  7. iReport 3.7

  8. Check the Install checkbox of ireport-designer, and press the Install button at the bottom of the window. The following screen will appear:
  9. iReport 3.7

  10. Press Next >, and accept the terms of the License Agreement.
  11. iReport 3.7

  12. If the Verify Certificate dialog box appears, click Continue.
  13. iReport 3.7

  14. Press Install, and wait for the installer to complete the installation.
  15. iReport 3.7

  16. After the installation is done, press Finish and close the Plugins dialog. If the IDE requests for a restart, then do it. Now the IDE is ready for creating reports.

iReport 3.7

Creating reports

We have already learnt about creating various types of reports, such as reports without parameters, reports with parameters, reports with variables, subreports, crosstab reports, reports with charts and images, and so on. We have also attained knowledge associated with these types of reports. Now, we will learn quickly how to create these reports using NetBeans with the help of the installed iReport plugins.

Creating a NetBeans database JDBC connection

The first step is to create a database connection, which will be used by the report data sources. Follow the listed steps:

  1. Select the Services tab from the left side of the project window.
  2. Select Databases.
  3. Right-click on Databases, and press New Connection….
  4. iReport 3.7

  5. In the New Database Connection dialog, set the following under Basic setting, and check the Remember password checkbox:

Option

Value

Driver Name

MySQL (Connector/J Driver)

Host

localhost

Port

3306

Database

inventory

User Name

root

Password

packt

iReport 3.7

  1. Press OK. Now the connection is created, and you can see this under the Services | Databases section, as shown in the following screenshot:

iReport 3.7

Creating a report data source

The NetBeans database JDBC connection created previously will be used by a report data source that will be used by the report. Follow the listed steps to create the data source:

  1. From the NetBeans toolbar, press the Report Datasources button. You will see the following dialog box:
  2. iReport 3.7

  3. Press New.
  4. Select NetBeans Database JDBC connection, and press Next >.
  5. iReport 3.7

  6. Enter inventory in the Name field, and from the Connection drop-down list, select jdbc:mysql://localhost:3306/inventory [root on Default schema].
  7. iReport 3.7

  8. Press Test, and if the connection is successful, press Save and close the Connections / Datasources dialog box.

iReport 3.7

LEAVE A REPLY

Please enter your comment!
Please enter your name here