How to create and publish Pentaho reports on a MySQL datasource
This how-to will guide you through your first own made pentaho report. The documentation and the Pentaho-wiki aren’t very useful for the beginning Pentaho developer.
This how-to is developed on Ubuntu 8.10, MySQL 5.0 and Pentaho 1.7.1 GA. Most things will work on windows, offcourse with different commands.
In this guide I use the MySQL Sakila sample database. Installation is simple:
- download the tar or zip and extract it on your desktop
- Open a console and go to the created directory.
- connect to MySQL:
mysql -u root -p
- import by execute two commands: source sakila-schema.sql ,
- Give the user ‘pentaho-user’ rights to this database
Now that we have data we have to create the Pentaho data sources. Open the server.xml with an editor:
sudo gedit /etc/tomcat6/server.xml
<Resource name="jdbc/sakila" auth="Container" type="javax.sql.DataSource" maxActive="20"
maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
url="jdbc:mysql://localhost/sakila" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
Before we want to make any reports we have to make sure we can publish reports on the Pentaho BI server. Pentaho keeps this password in the file “publish_config.xml” found in pentaho-solutions/system/. Default this password is blank… but I will make it the same as the Pentaho default:
You should know that this file is in the pentaho-solutions directory which is usually made readable for everyone. In a production environment further action must be taken to secure the BI server.
There are several ways to create Pentaho reports:
- Using the design studio (PDS)
- Using the report designer (PRD)
- Using the report design wizard
- Using the online AdHoc Reporting tool (WAQR)
Number 3 and 4 are maybe useful for end users, but have limited capabilities to create reports as an alternative against the commercial tools. The report design wizard can be executed from the design studio and report designer. In this example I will use the report design wizard only because it’s the quickest way to create a good looking example:
- Start the report designer
- Start Report Design Wizard under file menu or press CTRL-Shift-n
- The report design wizard opens with step 1. Choose a title and description (”films”, “list of films”), press next.
- choose connection type JNDI an click Add, make it something like this (fill in your specific username/password and test it):
- Specify Query String or use the query designer:
SELECT title, category, price , length FROM film_list
- Make sure you select the created connection an click Next
- Add the available items to the Selected Items (default) and click Next
- Click Next again
- click OK
We now have a simple report design with a list and a total. You can preview the report by clicking the preview button or click one of the two play icons or press CTRL-r.
Save the report.
Now we can publish it to the Pentaho BI server by pressing CTRL-shift-p. Fill in the right credential (defaults are: publish= password; username= joe; pw= password). Click OK.
Fill report name, description and choose a location ( pentaho-solution/samples ) an click publish… Ready!
This was just a very short howto and this example isn’t very useful, but it will guide you in the right direction. Next things todo can be: design (dynamic) parameter driver reports, create your own solution repository, dashboard design…