Use MySQL as Your Repository Database (Manual Installation)
Before you prepare your Pentaho Repository, you must prepare either a Windows or Linux environment.
The Pentaho Repository resides on the database that you installed during the Prepare Environment step, and consists of the following four components:
- Jackrabbit, which contains the solution repository, examples, security data, and content data from reports that you use Pentaho software to create;
- Quartz, which holds data that is related to scheduling reports and jobs;
- Hibernate, which holds data that is related to audit logging; and,
- Optional Pentaho Operations Mart, which reports on system usage and performance.
Initialize MySQL Pentaho Repository Database
To initialize MySQL so that it serves as the Pentaho Repository, you will need to run a few SQL scripts to create the Hibernate, Quartz, Jackrabbit (JCR), and Pentaho Operations Mart databases.
Use the ASCII character set when you run these scripts. Do not use UTF-8 because there are text string length limitations that might cause the scripts to fail.
The next few sections take you through the steps to initialize the MySQL Pentaho Repository database.
Step 1: Change Default Passwords
For your production server, we highly recommend that you change the default passwords in the following SQL script files to make the databases more secure.
If you are evaluating Pentaho, you might want to skip this step.
To change the passwords, go to the pentaho/server/pentaho-server/data/mysql5 directory and use any text editor to change the passwords in these SQL scripts:
- create_jcr_mysql.sql
- create_quartz_mysql.sql
- create_repository_mysql.sql
- pentaho_mart_mysql.sql
Step 2: Run SQL Scripts
You will need to run the SQL scripts in the table below.
These scripts require administrator permissions on the server in order to run them.
If you have a different port or different password, make sure that you change the password and port numbers in these examples to match the ones in your configuration.
Run these scripts from the MySQL Command Prompt window or from MySQL Workbench.
Action | SQL Script |
---|---|
Create Quartz | > source <your filepath>/create_quartz_mysql.sql |
Create Hibernate repository | > source <your filepath>/create_repository_mysql.sql |
Create Jackrabbit | > source <your filepath>/create_jcr_mysql.sql |
Create Pentaho Operations mart | > source <your filepath>/pentaho_mart_mysql.sql |
Step 3: Verify MySQL Initialization
After you run the scripts, perform the following steps to verify that databases and user roles have been created:
- Open the MySQL Workbench tool. MySQL Workbench is freely available at the MySQL development site.
- Log in as hibuser.
- Make sure that the Quartz, Jackrabbit (JCR), Hibernate, and Pentaho Operations Mart databases are present.
- Exit from the MySQL Workbench.
Configure MySQL Pentaho Repository Database
Now that you have initialized your repository database, you will need to configure Quartz, Hibernate, Jackrabbit, and Pentaho Operations Mart for a MySQL database.
By default, the examples in this section are for a MySQL database that runs on port 3306. The default password is also in these examples.
If you have a different port or different password, make sure that you change the password and port number in these examples to match those in your configuration.
Step 1: Set Up Quartz on MySQL Pentaho Repository Database
Event information, such as scheduled reports, is stored in the Quartz JobStore. During the installation process, you must indicate where the JobStore is located, by modifying the quartz.properties file.
- Open the pentaho/server/pentaho-server/pentaho-solutions/system/quartz/quartz.properties file in any text editor.
- Locate the #_replace_jobstore_properties section and set the org.quartz.jobStore.driverDelegateClass as shown here.
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
- Locate the # Configure Datasources section and set the org.quartz.dataSource.myDS.jndiURL equal to Quartz, like this.
org.quartz.dataSource.myDS.jndiURL = Quartz
- Save the file and close the text editor.
Step 2: Set Hibernate Settings for MySQL
Modify the Hibernate settings file to specify where Pentaho should find the Pentaho Repository’s Hibernate config file.
The Hibernate config file specifies driver and connection information, as well as dialects and how to handle connection closes and timeouts.
The files in this section are located in the pentaho/server/pentaho-server/pentaho-solutions/system/hibernate directory.
- Open the hibernate-settings.xml file in a text editor. Find the <config-file> tags and change postgresql.hibernate.cfg.xml to mysql5.hibernate.cfg.xml as shown.
From:<config-file>system/hibernate/postgresql.hibernate.cfg.xml</config-file>
To:<config-file>system/hibernate/mysql5.hibernate.cfg.xml</config-file>
- Save and close the file.
- Open the mysql5.hibernate.cfg.xml file in a text editor.
- Make sure that the password and port number match the ones you specified in your configuration. Make changes if necessary, then save and close the file.
Step 3: Replace Default Version of Audit Log File with MySQL Version
Since you are using MySQL to host the Pentaho Repository, you need to replace the audit_sql.xml file with one that is configured for MySQL.
- Locate the pentaho-solutions/system/dialects/mysql5/audit_sql.xml file.
- Copy it into the pentaho-solutions/system directory.
Step 4: Modify Jackrabbit Repository Information for MySQL
There are parts of code that you will need to alter in order to change the default JCR repository to MySQL.
- Navigate to the pentaho/server/pentaho-server/pentaho-solutions/system/jackrabbit and open the repository.xml file with any text editor.
- Following the table below, locate and change the code so that the MySQL lines are not commented out, but the PostgreSQL, MS SQL Server, and Oracle lines are commented out.
If you have a different port or different password, make sure that you change the password and port number in these examples to match those in your configuration.
Item: | Code Section: |
---|---|
Repository |
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/jackrabbit"/> … </FileSystem> |
DataStore |
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore"> <param name="url" value="jdbc:mysql://localhost:3306/jackrabbit"/> … </DataStore> |
Workspaces |
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/jackrabbit"/> … </FileSystem> |
PersistenceManager (1st part) |
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager"> <param name="url" value="jdbc:mysql://localhost:3306/jackrabbit"/> … <param name="schemaObjectPrefix" value="${wsp.name}_pm_ws_"/> </PersistenceManager> |
Versioning |
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/jackrabbit"/> … </FileSystem> |
PersistenceManager (2nd part) |
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager"> <param name="url" value="jdbc:mysql://localhost:3306/jackrabbit"/> … <param name="schemaObjectPrefix" value="${wsp.name}_pm_ws_"/> </PersistenceManager> |
DatabaseJournal |
<Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal"> <param name="revision" value="${rep.home}/revision.log"/> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/jackrabbit"/> <param name="user" value="jcr_user"/> <param name="password" value="password"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="J_C_"/> <param name="janitorEnabled" value="true"/> <param name="janitorSleep" value="86400"/> <param name="janitorFirstRunHourOfDay" value="3"/> </Journal> |
Using JBoss
If you are installing your own JBoss web application server, skip the Tomcat section and move on to Prepare JBoss Connections and Web App Servers.
Perform Tomcat-Specific Connection Tasks
After your repository has been configured, you must configure the web application servers to connect to the Pentaho Repository. In this section, you will make JDBC and JNDI connections to the Hibernate, Jackrabbit, and Quartz databases.
By default, the Pentaho Server software is configured to be deployed and run on the Tomcat server. As such, connections have already been specified and only the Tomcat context.xml file must be modified.
The next couple of sections guide you through the process of working with the JDBC drivers and connection information for Tomcat.
Step 1: Download Drivers and Apply to the Pentaho Server
To connect to a database, including the Pentaho Repository database, you will need to download and copy a JDBC driver to the appropriate places for Pentaho Server as well as on the the web application server.
Due to licensing restrictions, Pentaho cannot redistribute some third-party database drivers. You will have to download and install the file yourself.
- Download a JDBC driver JAR from your database vendor or a third-party driver developer.
- Copy the JDBC driver JAR you just downloaded to the pentaho/server/pentaho-server/tomcat/lib folder.
- Copy the
hsqldb-2.3.2.jar
file to pentaho-server/tomcat/lib if you want to retain the sample provided by Pentaho.
Step 2: Modify JDBC Connection Information in the Tomcat context.xml File
Database connection and network information, such as the username, password, driver class information, IP address or domain name, and port numbers for your Pentaho Repository database are stored in the context.xml file. Modify this file to reflect the database connection and network information to reflect your operating environment. You also modify the values for the validationQuery parameters in this file if you have chosen to use an Pentaho Repository database other than MySQL.
If you have a different port, password, user, driver class information, or IP address, make sure that you change the password and port number in these examples to match those in your configuration environment.
- Consult your database documentation to determine the JDBC class name and connection string for your Pentaho Repository database.
- Navigate to the pentaho-server/tomcat/webapps folder and use a zip extraction utility (such as 7-Zip, Winzip, or Archive) to view the contents of the pentaho.war file.
- Open the context.xml file with any text editor.
- Add the following code to the file if it does not already exist.
<Resource validationQuery="select 1" url="jdbc:mysql://localhost:3306/hibernate" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" initialSize="0" maxActive="20" maxIdle="10" maxWait="10000" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Hibernate"/> <Resource validationQuery="select 1" url="jdbc:mysql://localhost:3306/hibernate" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" initialSize="0" maxActive="20" maxIdle="10" maxWait="10000" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Audit"/> <Resource validationQuery="select 1" url="jdbc:mysql://localhost:3306/quartz" driverClassName="com.mysql.jdbc.Driver" password="password" username="pentaho_user" testOnBorrow="true" initialSize="0" maxActive="20" maxIdle="10" maxWait="10000" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Quartz"/> <Resource validationQuery="select 1" url="jdbc:mysql://localhost:3306/pentaho_operations_mart" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" initialSize="0" maxActive="20" maxIdle="10" maxWait="10000" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/pentaho_operations_mart"/> <Resource validationQuery="select 1" url="jdbc:mysql://localhost:3306/pentaho_operations_mart" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" initialSize="0" maxActive="20" maxIdle="10" maxWait="10000" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/PDI_Operations_Mart"/> <Resource name="jdbc/live_logging_info" auth="Container" type="javax.sql.DataSource" factory="org.apache.commons.dbcp.BasicDataSourceFactory" initialSize="0" maxActive="20" maxIdle="10" maxWait="10000" username="hibuser" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/pentaho_dilogs" validationQuery="select 1"/>
- Modify the username, password, driver class information, IP address (or domain name), and port numbers so they reflect the correct values for your environment.
- Make sure that the validationQuery variable for your database is set to this: validationQuery="select 1"
- Save the context.xml file, then close it.
- The zip extraction utility that you used might show a prompt which asks whether you would like to update the file in the pentaho.war archive. Confirm that you would like to update the file.
- Clear the tomcat/work and tomcat/temp directories.
Next Steps
- If you are using the JBoss web application server, follow the procedures in the article Prepare JBoss Connections and Web App Servers.
- If you are using the Tomcat web application server, follow the procedures in the article Configure and Start the Pentaho Server after Manual Installation.