Creating a JDBC Data Source Activity

 

 

 

Step

Action

1. 

Activity End Result

At the end of this activity you will have configured iReport with a JDBC data source connection as displayed. Reports created in these activities require queries. The connection configured in this activity allows you to write SQL queries that retrieve data from the sample foodmart database. That data populates the Employee and Department reports you develop during this course.

 

To configure the connection you:

- Specify the name, driver type, and connection string for the JDBC Connection

- Specify the Username and Password to access the data source

2. 

The activity starts with no configured data source.

 

Begin by clicking the Report Datasources button.

3. 

Note: The Connections / Datasources window appears. This window lists all currently configured connections.

4. 

Click the New button to begin configuring a data source.

5. 

Note: The Datasource window appears. From this list, select the data source type you want to create. iReport supports many data source types, and allows you to create custom data source connections.

6. 

Click the Database JDBC connection list item.

7. 

Click the Next button.

8. 

Note: The Database JDBC connection window appears. Configure the connection as follows:

 

- Name: foodmart (the sample database this course uses)

- Driver: PostgreSQL (org.postgresql.Driver)

- URL: jdbc:postgresql://localhost:5432/foodmart

- Username: jasperdb

- Password: password

- Check the Save password box

9. 

foodmart is a sample database that ships with the application software. The foodmart database is available only if the sample data is installed.

 

Enter "foodmart" into the Name field.

10. 

Click the JDBC Driver drop-down button to activate the menu.

11. 

Click the PostgreSQL (org.postgresql.Driver) list item.

12. 

Click in the JDBC URL field.

13. 

Press the [Backspace] key to delete the word MYDATABASE.

14. 

Enter "foodmart" into the JDBC URL field.

15. 

Enter "jasperdb" into the Username field.

16. 

Enter "password" into the Password field.

17. 

Selecting the Save password checkbox configures iReport to store the password so you don't have to enter it each time you access the data source.

 

Click the Save password option.

18. 

The Test feature makes sure the connection works properly.

 

Click the Test button.

19. 

Note: If the connection test fails, check for typos in the Database JDBC connection window.

20. 

Click the OK button.

21. 

Click the Save button to save the configuration and close the window.

22. 

Note: The new foodmart JDBC data source is saved. The new connection becomes the default selection as well.

23. 

Click the Close button to close the Datasources window.

24. 

Note: foodmart now appears in the drop-down box on the tool bar.

25. 

Congratulations!

 

You successfully created and tested a JDBC data source connection.

 

View the Online Learning Portal here (http://www.jaspersoft.com/online-learning-portal).

End of Procedure.