Skip to main content
Pentaho Documentation

Use MySQL as Your Repository Database

Overview

Explains how to configure and use MySQL as your BA Repository database.

Before you prepare your Business Analytics (BA) Repository, complete the tasks in Prepare Environment.

The BA Repository resides on the database that you installed during the Prepare Environment step, and consists of four repositories: Jackrabbit, Quartz, Hibernate, and Pentaho Operations Mart.

  • Jackrabbit contains the solution repository, examples, security data, and content data from reports that you use Pentaho software to create.
  • Quartz holds data that is related to scheduling reports and jobs.
  • Hibernate holds data that is related to audit logging.
  • Pentaho Operations Mart reports on system usage and performance.

Initialize MySQL BA Repository Database

To initialize MySQL so that it serves as the BA 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 BA repository database.

Step 1: Change Default Passwords

We recommend that you change the default passwords in the SQL script files. If you are evaluating Pentaho, you might want to skip this step.

If you do decide to make the databases more secure, go to the pentaho/server/biserver-ee/data/mysql5 directory and use any text editor to change the passwords in these files:

  • create_jcr_mysql.sql
  • create_quartz_mysql.sql
  • create_repository_mysql.sql
  • pentaho_mart_mysql.sql

Step 2: Run SQL Scripts

Once you change the passwords, you will need to run these SQL scripts. You will need administrator permissions on the server in order to run these scripts. The list of  SQL scripts is shown in the table below.

If you have a different port or different password, make sure that you change the password and port number 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, this list will help you verify that databases and user roles have been created.

  1. Open the MySQL Workbench tool. MySQL Workbench is freely available at the MySQL development site.
  2. Log in as hibuser.
  3. Make sure that the Quartz, Jackrabbit (JCR), Hibernate, and Pentaho Operations Mart databases are present.
  4. Exit from the MySQL Workbench.

Configure MySQL BA 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 the ones in your configuration.

Step 1: Set Up Quartz on MySQL BA 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.

  1. Open the pentaho/server/biserver-ee/pentaho-solutions/system/quartz/quartz.properties file in any text editor.
  2. 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
    
  3. Locate the # Configure Datasources section and set the org.quartz.dataSource.myDS.jndiURL equal to Quartz, like this.
    org.quartz.dataSource.myDS.jndiURL = Quartz
    
  4. 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 BA 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/biserver-ee/pentaho-solutions/system/hibernate directory.

  1. 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>
    
  2. Save and close the file.
  3. Open the mysql5.hibernate.cfg.xml file in a text editor.
  4. 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 BA Repository, you need to replace the audit_sql.xml file with one that is configured for MySQL.

  1. Locate the pentaho-solutions/system/dialects/mysql5/audit_sql.xml file.
  2. 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.

  1. Navigate to the pentaho/server/biserver-ee/pentaho-solutions/system/jackrabbit and open the repository.xml file with any text editor.
  2. 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 the ones 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"/>
…
</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"/>
      …
</PersistenceManager>

Perform Tomcat-Specific Connection Tasks

After your repository has been configured, you must configure the web application servers to connect to the BA Repository. In this section, JDBC and JNDI connections are made to the Hibernate, Jackrabbit, and Quartz databases.

By default, the BA 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 Install with the JDBC Distribution Tool

To connect to a database, including the Pentaho Repository database, you will need to download and install a JDBC driver to the appropriate places for Pentaho components as well as on the the web application server that contains the Pentaho Server(s). Fortunately, the JDBC Distribution Tool makes this process easy. 

Due to licensing restrictions, Pentaho cannot redistribute some third-party database drivers. This is why you have to download the file yourself and install it yourself.

  1. Download a JDBC driver JAR from your database vendor or a third-party driver developer.
  2. Copy the JDBC driver JAR you just downloaded to the pentaho/jdbc-distribution directory.
  3. Open a cmd prompt or shell tool, navigate to the pentaho/jdbc-distribution directory and enter one of the following:

​Windows:

distribute-files.bat <name of JDBC driver JAR>

Linux:

./distribute-files.sh <name of JDBC driver JAR>
  1. If you have run this utility as part of the installation process, you are done. Go to the next step of the installation instructions.
  2. If you have run this utility so that you can connect to a new repository, restart the BA or DI Server and Design tools, then try to connect to the new repository. If you cannot connect, verify that the drivers are installed as shown in this table. Restart your Pentaho Server(s) and Client tools.
List of Products and Corresponding Locations for JDBC Drivers
Server or Design Tool Directory
Business Analytics (BA) Server pentaho/server/biserver-ee/tomcat/lib
Data Integration (DI) Server pentaho/server/data-integration-server/tomcat/lib
Pentaho Data Integration (Spoon) pentaho/design-tools/data-integration/lib
Pentaho Report Designer (PRD) pentaho/design-tools/report-designer/lib/jdbc
Pentaho Aggregation Designer (PAD) pentaho/design-tools/aggregation-designer/drivers
Pentaho Schema Workbench (PSW) pentaho/design-tools/schema-workbench/drivers
Pentaho Metadata Editor (PME) pentaho/design-tools/metadata-editor/libext/JDBC

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 BA 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 BA Repository database other than PostgreSQL.

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 the ones in your configuration environment.

  1. Consult your database documentation to determine the JDBC class name and connection string for your BA Repository database.
  2. Go to the biserver-ee/tomcat/webapps/pentaho/META-INF directory and open the context.xml file with any file editor.
  3. Comment out the resource references that refer to databases other than MySQL, such as PostgreSQL, MS SQL Server, and Oracle. Then, add the following code to the file if it does not already exist. Be sure to adjust the port numbers and passwords to reflect your environment, if necessary.
    <Resource validationQuery="select 1" url="jdbc:mysql://localhost:3306/hibernate" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" maxWaitMillis="10000" maxIdle="5" maxTotal="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" 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" maxWaitMillis="10000" maxIdle="5" maxTotal="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" 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" maxWaitMillis="10000" maxIdle="5" maxTotal="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" 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" maxWaitMillis="10000" maxIdle="5" maxTotal="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" 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" maxWaitMillis="10000" maxIdle="5" maxTotal="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/PDI_Operations_Mart"/>
    
  4. Make sure that the validationQuery variable for your database is set to this: validationQuery="select 1"
  5. Save the context.xml file, then close it.

Next Steps

Now it is time to start your server.