From time to time we get the same question on the Pentaho Reporting Forum:
“How do I integrate the Pentaho Bi-Server and reporting capabilities with my own (PHP/ASP/JSP/Ruby/whatever-) web-application?” Thrilled by the BI-Server’s blazing features, many users want to enrich their applications with rich reporting and analysis capabilities, and unlike the dinosaurs of the BI-Market, our Open-Source solution makes this easy and cost effective.
The techniques I am going to describe in this blog-post are no magic and can be applied to other web-application (like our Data-Integration server) as well.
First, you need to get a Pentaho system up and running. For now, and for the sake of easiness, lets stick with the standard Pre-Configured Installation (PCI). The Pentaho PCI is a Apache Tomcat server that runs the Pentaho BI-Server as its only web-application.
Installing the Pentaho BI-Server
- Download Pentaho
- Unpack the ZIP or tar.gz archive into a directory. On Linux or Unix systems, I would recommend something like “/opt” or “/usr/local/” as target. On Windows .. well, in that case you are just experimenting and not planing for production, I assume. So any folder will do.
- Setup a publish password
You need that later for publishing reports or other files to the server. This is the major obstacle for most new users when trying to get their own content up and running.
- Edit the file “bi-server-ce/tomcat/webapps/pentaho/WEB-INF/web.xml”
Change the parameter “fully-qualified-server-url” to the public URL of your server.
- Optional: If some other tomcat installation runs on your system, your port 8080 may be in use already.
You can change the port in the file “bi-server-ce/tomcat/conf/server.xml”:
- Start the Hypersonic database
- Start the Pentaho BI-server
- Optional: Install the BI-Server as a system service.
You should now be able to direct your web-browser to the BI-Server and should see the login screen when you type
http://localhost:8080/ into your browser’s address bar.
Integration by Direct Linking
Integrating a BI-Server into a existing PHP application is easy now. All you need is a running BI-Server instance that is accessible by your users. From now on, I will simply use the Pentaho Demo Server for our little integration project.
The Pentaho Demo Server is a slightly tuned down installation of the Pentaho BI-Server. Anything I am going to show will work in the same way with the standard community edition.
When refering to the two applications, I will use “application” for the PHP, ASP or Ruby application that wants to utilize the Pentaho Platform. I will use the term “Pentaho” for the Pentaho BI-Server.
The most primitive way of connection two web applications together is to make the application include Pentaho in an frame or by opening up the specific report or analysis view in a new window.
My Web Application
This file could have been generated by any server side program. Use your phantasy here.
Reports can be parametrized by adding the parameters for the report to the URL. The parameters must be properly URL encoded. Use UTF-8 as character encoding.
This shows how to open up a report in a new Window: A report
Inside the Pentaho Platform, each report has its own page that can be accessed independently of the Pentaho User Console. The sample above links to a report on the system, using the predefined username and password. Note that the username and password is given in cleartext. To make this more secure you will need to set up a Single-Sign-On solution.
Pentaho Enterprise Edition comes with support for setting up Single-Sign-On for CAS rather easily via some setup scripts that take care of the ugly work. If you are using community edition and are willing to spend the time, you can always set it up yourself.
Alternatively you can set up Pentaho to work with Active Directory or LDAP instead.
Here are some sites with documentation to get you started.
And don’t forget: The Pentaho Wiki also contains a load of information.
Internally, Pentaho uses Spring Security, so with enough time and patience you should be able to connect Pentaho to anything on this planet for authentication purposes.