Skip to main content
Pentaho Documentation

Use PostgreSQL as Your Repository Database (Manual Installation)

Overview

Explains how to configure and use PostgreSQL as your Pentaho Repository database.

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, Quartz, Hibernate, and the optional 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.
  • Optional Pentaho Operations Mart reports on system usage and performance.

Initialize PostgreSQL Pentaho Repository Database

To initialize PostgreSQL so that it serves as the Pentaho Repository, you will need to run several SQL scripts to create the Hibernate, Quartz, Jackrabbit (JCR), and Pentaho Operations Mart components.

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.

These sections take you through the steps to initialize the PostgreSQL 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, then you might want to skip this step.

To change the passwords, go to the pentaho/server/pentaho-server/data/postgresql directory and use any text editor to change the passwords in these SQL scripts:

  • create_jcr_postgresql.sql
  • create_quartz_postgresql.sql
  • create_repository_postgresql.sql
  • pentaho_mart_postgresql.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 PSQL Console window in the pgAdminIII tool:

Action SQL Script
SQL Scripts
Create Quartz \i <your filepath>/data/postgresql/create_quartz_postgresql.sql
Create Hibernate repository \i <your filepath>/data/postgresql/create_repository_postgresql.sql
Create Jackrabbit \i <your filepath>/data/postgresql/create_jcr_postgresql.sql
Create Pentaho Operations Mart \i <your filepath>/data/postgresql/pentaho_mart_postgresql.sql

Step 3: Verify PostgreSQL Initialization

After you run the scripts, perform the following steps to verify that databases and user roles have been created:

  1. Open the pgAdminIII tool.
  2. Verify that you can log on as hibuser.
  3. Once logged on, check that the Quartz, Jackrabbit (JCR), Hibernate, and Pentaho Operations Mart components are present.
  4. Exit from the pgAdminIII.

Configure PostgreSQL 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 PostgreSQL database.

PostgreSQL is configured by default; if you kept the default passwords and port, you will not need to set up Quartz, Hibernate, Jackrabbit or the Pentaho Operations Mart. You can skip ahead to the Tomcat-specific connection tasks or the JBoss connection tasks.

By default, the examples in this section are for a PostgreSQL database that runs on port 5432. 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 PostgreSQL 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.

  1. Open the pentaho/server/pentaho-server/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.PostgreSQLDelegate
    
  3. Locate the # Configure Datasources section and set the org.quartz.dataSource.myDS.jndiURL equal to Quartz, like this. This setting varies depending on the web server you have chosen for this installation.
    • If using JBoss, this setting should be:
      org.quartz.dataSource.myDS.jndiURL = jboss/datasources/Quartz
    • If using Tomcat, this setting should be:
      org.quartz.dataSource.myDS.jndiURL = Quartz
      
  4. Save the file and close the text editor.

Step 2: Modify Jackrabbit Repository Information for PostgreSQL

There are parts of code that you will need to alter to change the default jackrabbit repository to PostgreSQL.

  1. Navigate to the pentaho/server/pentaho-server/pentaho-solutions/system/jackrabbit and open the repository.xml file with any text editor.
  2. Following the table below, locate and verify or change the code so that the PostgreSQL lines are not commented out, but the MySQL, Oracle, and MS SQL Server 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="org.postgresql.Driver"/>
    <param name="url" value="jdbc:postgresql://localhost:5432/jackrabbit"/>
    ...
  </FileSystem>
DataStore
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
    <param name="url" value="jdbc:postgresql://localhost:5432/jackrabbit"/>
    ...
  </DataStore>
Workspaces
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="driver" value="org.postgresql.Driver"/>
      <param name="url" value="jdbc:postgresql://localhost:5432/jackrabbit"/>
     ...
    </FileSystem>

PersistenceManager

(1st part)

<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
      <param name="url" value="jdbc:postgresql://localhost:5432/jackrabbit"/>
      ...
    </PersistenceManager>
Versioning
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="driver" value="org.postgresql.Driver"/>
      <param name="url" value="jdbc:postgresql://localhost:5432/jackrabbit"/>
     ...
    </FileSystem>

PersistenceManager

(2nd part)

<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
      <param name="url" value="jdbc:postgresql://localhost:5432/jackrabbit"/>
      ...
    </PersistenceManager>
DatabaseJournal
<Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
    <param name="revision" value="${rep.home}/revision.log"/>
    <param name="url" value="jdbc:postgresql://localhost:5432/jackrabbit"/>
    <param name="driver" value="org.postgresql.Driver"/>
    <param name="user" value="jcr_user"/>
    <param name="password" value="password"/>
    <param name="schema" value="postgresql"/>
    <param name="schemaObjectPrefix" value="cl_j_"/>
    <param name="janitorEnabled" value="true"/>
    <param name="janitorSleep" value="86400"/>
    <param name="janitorFirstRunHourOfDay" value="3"/>
</Journal>

Are You 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 step, you will make JDBC and JNDI connections to the Hibernate, Jackrabbit, and Quartz components.

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 the Tomcat context.xml file must be modified ONLY if you have changed the default ports or passwords.

The next couple of sections guide you through the process of working with the JDBC drivers and connection information for Tomcat.

Step 1: Download Driver 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 the 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.

  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/server/pentaho-server/tomcat/lib folder.
  3. Verify the PostgreSQL driver is in the pentaho-server/tomcat/lib folder. If it is not there, copy it into that folder.
  4. 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 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 Pentaho Repository database.
  2. Go to the pentaho-server/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 PostgreSQL, such as MySQL, 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 name="jdbc/Hibernate" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxTotal="20" maxIdle="5" maxWaitMillis="10000" username="hibuser" password="password" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/hibernate" validationQuery="select 1"/>
    <Resource name="jdbc/Audit" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxTotal="20" maxIdle="5" maxWaitMillis="10000" username="hibuser" password="password" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/hibernate" validationQuery="select 1"/>
    <Resource name="jdbc/Quartz" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxTotal="20" maxIdle="5" maxWaitMillis="10000" username="pentaho_user" password="password" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/quartz" validationQuery="select 1"/>
    <Resource name="jdbc/pentaho_operations_mart" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxTotal="20" maxIdle="5" maxWaitMillis="10000" username="hibuser" password="password" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/pentaho_operations_mart" validationQuery="select 1"/>
    <Resource name="jdbc/PDI_Operations_Mart" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxTotal="20" maxIdle="5" maxWaitMillis="10000" username="hibuser" password="password" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/hibernate" validationQuery="select 1"/>
    
  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.
  6. Clear the tomcat/work and tomcat/temp directories. 

Start Your Server

Now that you have completed the initial installation steps, you are ready to start the Pentaho Server.

Learn more