Pentaho 5.0 Reporting by Example
上QQ阅读APP看书,第一时间看更新

Time for action – downloading and installing Sakila DB

Sakila DB can be downloaded from http://dev.mysql.com/doc/index-other.html.

After browsing to that URL, follow these steps to download and install Sakila:

  1. In the Example Databases section, you will find the links to download Sakila DB, as shown in the following screenshot.
  2. Once the correct file has been downloaded, we will unzip it in a temporary folder that we will call [SAKILA_TMP].
  3. Then, we will execute two commands in a terminal to create the database and populate it with data.
  4. First, we will execute the sakila-schema.sql script to create the general schema of the Sakila database, that is, the tables, views, and so on. After executing the following command, we will be asked for the root user password. This is determined by the following command:
    p.shell> mysql -u root -p <[SAKILA_TMP]/sakila-schema.sql
  5. Next, we will execute the sakila-data.sql script to insert the example data in Sakila DB. Here too, we must enter the root user password: shell> mysql -u root -p <[SAKILA_TMP]/sakila-data.sql. Next, we will perform a small test to verify that everything is okay. First, we log in to MySQL through the following command (remember to enter the root user password):
    shell> mysql -u root -p
  6. We then connect to the Sakila database:
    mysql> use sakila;
  7. Now, we will display a list of all the tables in the Sakila database:
    mysql> show tables;
  8. Type the exit command to quit MySQL CLP.

What just happened?

We have downloaded the sakila-db package and executed scripts to create the database and populate it with data using the MySQL command-line processor (CLP).

The Sakila database schema

With the script files that contain the physical schema and the data, the package we downloaded contains a third file called sakila.mwb. This file contains a diagram of the database to be used with MySQL Schema Workbench. In the following sections, we show the database model, and we divide it into the following three subdiagrams for easy understanding:

  • Customer Data
  • Inventory
  • Business

The information about Sakila DB in this chapter is based on the official documentation, which can be found at http://dev.mysql.com/doc/sakila/en/index.html.

In the Appendix A, Sakila DB Data Dictionary, we have a detailed data dictionary (DD) complete with a sample of data from each table in the Sakila DB.

Customer Data

Client information is stored in four tables, three of which contain information about the addresses that will be used for other entities, such as staff and store.

Inventory

Information about movies is stored in eight tables. We can distinguish between the logical definition of a movie and its physical copies that are stored in the inventory table.

Business

Information about business is stored in four tables. The structure allows us to store information about the employees of each store and information about rentals and payments.

Have a go hero

We propose that you investigate the folder structure of Pentaho Report Designer and their respective content.

To do this, you must go to the PRD installation path, that is, [PRD_HOME] and seek answers to the following questions:

  • Which files are in the root?
  • What's in the lib folder?
  • What's in the plugins folder?
  • What's in the samples folder?
  • What's in the templates folder?

Pop quiz – system requirements, JDBC driver, Sakila DB, and RAM

Q1. Which of the following affirmations are true?

  1. In order to run Pentaho Report Designer, JDK must be installed first.
  2. A JDBC driver is an implementation of a relational database.
  3. To include a JDBC driver in PRD, you must copy it in the [PRD_HOME]/lib/jdbc path.
  4. The database we use to practice this book is called Sakila, and it stores information about sales and purchases.
  5. To add more RAM to PRD, it's necessary to edit the report-designer.sh file or report-designer.bat file, as appropriate.