Skip to main content
Pentaho Documentation

Specify Connections

Overview

Indicates how to specify connections to the web app server.

Image of the DI Server installation steps.

After your repository has been configured, you must configure the web application servers to connect to the DI Repository. In this step, JDBC and JNDI connections are made to the Hibernate, Jackrabbit, and Quartz databases. These databases were installed on your DI Repository database during the Initialize Repository and Configure Repository sections of these instructions.

By default, the DI 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. Complete the following tasks.

Perform Tomcat-Specific Connection Tasks

If you plan to run the DI Server on Tomcat, you must modify JDBC Connection information.

Copy Solution Database JDBC Drivers

For the DI Server to connect to the DI Repository database of your choice, add the DI Repository's database JDBC driver library to the appropriate place in the web application server on which the DI Server will be deployed. The default web application server for the archive installation process is Tomcat.
  1. Download a JDBC driver JAR from your database vendor or a third-party driver developer.

    Due to licensing restrictions, Pentaho does not distribute the necessary JDBC driver JARs.

  2. Copy the JDBC driver JAR you just downloaded to the /tomcat/lib/ directory.

Download and Install H2 JDBC Drivers

Install the H2 JDBC driver.
  1. Download the version 1.2.131 of the H2 JDBC JAR from the http://code.google.com/p/h2database/downloads/list.
  2. Copy the JDBC driver JAR you just downloaded to the tomcat/lib/ directory.

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 DI Repository database are stored in the context.xml file. You will need to 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 choosen to use an DI Repository database other than PostgreSQL.

  1. Consult your database documentation to determine the JDBC class name and connection string for your DI Repository database.
  2. Extract the context.xml file from the pentaho-di.war file that is in the tomcat/webapps/pentaho-di/META-INF/ directory.
  3. Use a text editor of your choice to open the context.xml file.
  4. Do one of these things.
    1. If you are using PostgreSQL as your DI Repository database, ensure that comments are removed from the resource names for the PostgreSQL database and comment out the resource names for the other databases. In the PostgreSQL sections, adjust the port numbers and passwords to reflect your environment, if necessary.
      <Resource validationQuery="select 1" url="jdbc:postgresql://localhost:5432/di_hibernate" driverClassName="org.postgresql.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Hibernate"/>
      <Resource validationQuery="select 1" url="jdbc:postgresql://localhost:5432/di_hibernate" driverClassName="org.postgresql.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Audit"/>
      <Resource validationQuery="select 1" url="jdbc:postgresql://localhost:5432/di_quartz" driverClassName="org.postgresql.Driver" password="password" username="pentaho_user" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Quartz"/>
      <Resource validationQuery="select 1" url="jdbc:postgresql://localhost:5432/di_hibernate" driverClassName="org.postgresql.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/pentaho_operations_mart"/>
      <Resource validationQuery="select 1" url="jdbc:postgresql://localhost:5432/di_hibernate" driverClassName="org.postgresql.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/PDI_Operations_Mart"/>
    2. If you are using MySQL as your DI Repository database, remove comments from the resource names for the MySQL database and comment out the resource names for the other databases. In the MySQL sections, adjust the port numbers and passwords to reflect your environment, if necessary.
      <Resource validationQuery="/* ping */ select 1" url="jdbc:mysql://localhost:3306/di_hibernate" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Hibernate"/>
      <Resource validationQuery="/* ping */ select 1" url="jdbc:mysql://localhost:3306/di_hibernate" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Audit"/>
      <Resource validationQuery="/* ping */ select 1" url="jdbc:mysql://localhost:3306/di_quartz" driverClassName="com.mysql.jdbc.Driver" password="password" username="pentaho_user" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Quartz"/>
      <Resource validationQuery="/* ping */ select 1" url="jdbc:mysql://localhost:3306/pentaho_operations_mart" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/pentaho_operations_mart"/>
      <Resource validationQuery="/* ping */ select 1" url="jdbc:mysql://localhost:3306/pentaho_operations_mart" driverClassName="com.mysql.jdbc.Driver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/PDI_Operations_Mart"/>
    3. If you are using Oracle as your DI Repository database, remove comments from the resource names for the Oracle database and comment out the resource names for the other databases. In the Oracle sections, adjust the port numbers and passwords to reflect your environment, if necessary.
      <Resource validationQuery="select 1 from dual" url="jdbc:oracle:thin:@localhost:1521/XE" driverClassName="oracle.jdbc.OracleDriver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Hibernate"/>
      <Resource validationQuery="select 1 from dual" url="jdbc:oracle:thin:@localhost:1521/XE" driverClassName="oracle.jdbc.OracleDriver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Audit"/>
      <Resource validationQuery="select 1 from dual" url="jdbc:oracle:thin:@localhost:1521/XE" driverClassName="oracle.jdbc.OracleDriver" password="password" username="di_quartz" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/Quartz"/>
      <Resource validationQuery="select 1 from dual" url="jdbc:oracle:thin:@localhost:1521/XE" driverClassName="oracle.jdbc.OracleDriver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/pentaho_operations_mart"/>
      <Resource validationQuery="select 1 from dual" url="jdbc:oracle:thin:@localhost:1521/XE" driverClassName="oracle.jdbc.OracleDriver" password="password" username="hibuser" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" auth="Container" name="jdbc/PDI_Operations_Mart"/>
  5. Modify the username, password, driver class information, IP address (or domain name), and port numbers so they reflect the correct values for your environment.
  6. Make sure that the validationQuery variable for your database is set to one of these.
    • PostgreSQLvalidationQuery="select 1"
    • MySQL:validationQuery="select 1"
    • Oracle:validationQuery="select 1 from dual"
  7. Save the context.xmlfile, then close it.
  8. To verify that the changes have been made and saved, do this.
    1. Open the context.xml file again. Make sure that the changes that you made to the file in these instructions have been saved.
    2. Close the file.
    3. Repackage the context.xml file with the pentaho-di.war file.
  9. To make sure that the changes that you made in the context.xml file take effect when Tomcat, navigate to the pentaho\server\data-integration-server\tomcat\conf\Catalina directory. If the pentaho-di.xml file is in the present, delete it. It will be generated again when you start the DI Server, but will contain the changes that you just made in the context.xml file.

Perform JBoss-Specific Connection Tasks

To define JDBC and JNDI connections, several JBoss-specific tasks are required.

Install JDBC Driver as a Module in JBoss

In JBoss, JDBC driver information is stored in a module, which is an XML file that you create. You must download the JDBC driver software component to the correct directory, then create module.xml files for each database. You need to create a file for the database that hosts the DI Repository (either PostgreSQL, MySQL, or Oracle), as well as for HSQLDB and H2.
  1. Navigate to the pentaho/server/data-integration-server/<your jboss installation directory>/modules/system/layers/base/org folder and create one of the following paths for the database on which you are hosting the DI Repository.
    • PostgreSQL: postgresql/main
    • MySQL: mysql/main
    • Oracle: oracle/main
  2. In the pentaho/server/data-integration-server/<your jboss installation directory>/modules/system/layers/base/com/h2database, create the following two paths.
    • HSQLDB: hsqldb/main
    • H2: h2/main
  3. Download the supported JDBC driver for your DI Repository database to the postgresql/main, mysql/main, or oracle/main directories (which ever one you created). See the JDBC Drivers Reference for a list of supported drivers.
  4. Download the supported JDBC drivers for HSQLDB and H2. Place HQSLDB's driver in the hsqldb/main directory . Place H2's driver in the h2/main directory. See the JDBC Drivers Reference for a list of supported drivers.
  5. In the postgresql/main, mysql/main, or oracle/main (which ever one you created), do the following things.
    1. Use an editor to create a text file named module.xml.
    2. Copy the following code to the module.xml file, then modify it so that the name of the JDBC driver you just downloaded appears.
          <?xml version="1.0" encoding="UTF-8"?>
          <module xmlns="urn:jboss:module:1.0" name="org.postgresql">
              <resources>
                  <resource-root path="[Name of JDBC Jar You Downloaded Here]"/>
              </resources>
              <dependencies><module name="javax.api"/></dependencies>
          </module>  
      <?xml version="1.0" encoding="UTF-8"?>
          <module xmlns="urn:jboss:module:1.0" name="org.mysql">
              <resources>
                  <resource-root path="[Name of JDBC Jar You Downloaded Here]"/>
              </resources>
              <dependencies><module name="javax.api"/></dependencies>
          </module>  
      • postgreSQL: If you are using PostgreSQL, copy the following code in the module.xml file. Replace the name of the resource-root path parameter with the name of the JDBC driver you downloaded.
      • MySQL: If you are using MySQL, copy the following code in the module.xml file. Replace the name of the resource-root path parameter with the name of the JDBC driver you downloaded.
      • Oracle: If you are using Oracle, copy the following following code in the module.xml file. Replace the name of the resource-root path parameter with the name of the JDBC driver you downloaded.
            <?xml version="1.0" encoding="UTF-8"?>
            <module xmlns="urn:jboss:module:1.0" name="org.oracle">
                <resources>
                    <resource-root path="[Name of JDBC Jar You Downloaded Here]"/>
                </resources>
                <dependencies><module name="javax.api"/></dependencies>
            </module>  
    3. Save and close the module.xml file.
  6. In the hsqldb/main directory, do these things.
    1. Use an editor to create a text file named module.xml.
    2. Copy the following code to the module.xml file, then modify it so that the name of the JDBC driver you just downloaded appears in the resource-root path.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.h2database.hsqldb">
<resources>
<resource-root path="[Name of JDBC Jar You Downloaded Here]"/>
</resources>
<dependencies><module name="javax.api"/></dependencies>
</module>
  1. Save and close the module.xml file.
  2. In the h2/main directory, do these things.
    1. Use an editor to create a text file named module.xml.
    2. Copy the following code to the module.xml file, then modify it so that the name of the JDBC driver you just downloaded appears in the resource-root path.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.h2database.h2">
<resources>
<resource-root path="[Name of JDBC Jar You Downloaded Here]"/>
</resources>
<dependencies><module name="javax.api"/></dependencies>
</module>
  1. Save and close the module.xml file.

Define JNDI Database Connection Information in JBoss

JNDI is used to specify port, driver, user name, and password information for the Audit and Quartz databases that are housed on your BA Repository database. JNDI provides a common interface for different naming services, such as DNS, LDAP, and Microsoft Active Directory. Instead of having to remember the details for how to connect or interact with the data for many different naming services, you need to only use an XML to specify the information you want to pass to the naming service.

  1. Use a text editor to open the pentaho/server/data-integration-server/jboss/standalone/configuration/standalone.xml file.
  2. Insert these lines after the definition of ExampleDS data source.
       <datasource jndi-name="java:jboss/datasources/Hibernate" pool-name="hibpool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                        <connection-url>
                            jdbc:postgresql://localhost:5432/di_hibernate
                        </connection-url>
                        <driver-class>
                            org.postgresql.Driver
                        </driver-class>
                        <driver>
                            org.postgresql
                        </driver>
                        <pool>
                            <prefill>
                                false
                            </prefill>
                            <use-strict-min>
                                false
                            </use-strict-min>
                            <flush-strategy>
                                FailingConnectionOnly
                            </flush-strategy>
                        </pool>
                        <security>
                            <user-name>
                                hibuser
                            </user-name>
                            <password>
                                password
                            </password>
                        </security>
                    </datasource>
                    <datasource jndi-name="java:jboss/datasources/Quartz" pool-name="quartzpool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                        <connection-url>
                            jdbc:postgresql://localhost:5432/di_quartz
                        </connection-url>
                        <driver-class>
                            org.postgresql.Driver
                        </driver-class>
                        <driver>
                            org.postgresql
                        </driver>
                        <pool>
                            <prefill>
                                false
                            </prefill>
                            <use-strict-min>
                                false
                            </use-strict-min>
                            <flush-strategy>
                                FailingConnectionOnly
                            </flush-strategy>
                        </pool>
                        <security>
                            <user-name>
                                pentaho_user
                            </user-name>
                            <password>
                                password
                            </password>
                        </security>
                    </datasource>
                    <datasource jndi-name="java:jboss/datasources/Audit" pool-name="auditpool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                        <connection-url>
                            jdbc:postgresql://localhost:5432/di_hibernate
                        </connection-url>
                        <driver-class>
                            org.postgresql.Driver
                        </driver-class>
                        <driver>
                            org.postgresql
                        </driver>
                        <pool>
                            <prefill>
                                false
                            </prefill>
                            <use-strict-min>
                                false
                            </use-strict-min>
                            <flush-strategy>
                                FailingConnectionOnly
                            </flush-strategy>
                        </pool>
                        <security>
                            <user-name>
                                pentaho_user
                            </user-name>
                            <password>
                                password
                            </password>
                        </security>
                    </datasource> 
                     <datasource jndi-name="java:jboss/datasources/PDI_Operations_Mart" pool-name="PDI_Operations_Martpool" enabled="true" jta="true" use-java-context="true" use-ccm="true"> 
         <connection-url> 
             jdbc:postgresql://localhost:5432/di_hibernate 
         </connection-url> 
         <driver-class> 
             org.postgresql.Driver 
         </driver-class> 
         <driver> 
             org.postgresql 
         </driver> 
         <pool> 
             <prefill> 
                 false 
             </prefill> 
             <use-strict-min> 
                 false 
             </use-strict-min> 
             <flush-strategy> 
                 FailingConnectionOnly 
             </flush-strategy> 
         </pool> 
         <security> 
             <user-name> 
                 hiuser 
             </user-name> 
             <password> 
                password 
             </password> 
         </security> 
    </datasource> 
  3. If your environment (e.g. port numbers, IP address), solution repository, or database password and username information differs from the code you added in the previous step, modify it to match your specifications.
  4. Add the driver definition in the driver section of the file. Here is an example of the PostgreSQL driver definition. If you are using MySQL or Oracle, modify the driver name, module, and data source class accordingly.
     <driver name="org.postgresql" module="org.postgresql">
      <xa-datasource-class>
          org.postgresql.xa.PGXADataSource
          </xa-datasource-class>
      </driver>
  5. Close and save the standalone.xmlfile.
  6. Open the pentaho/server/data-integration-server/pentaho-solutions/system/applicationContext-spring-security-jdbc.xml file. Change the port number, driver class name, user name, and password to reflect your environment's settings, if necessary. When complete, save and close the file.

Add JBoss Deployment Structure File to pentaho-di.war

The jboss-deployment-structure.xml file controls class loading. It prevents automatic dependences from being
added, adds dependences, defines additional modules, changes isolated class loading behavior, and adds additional
resource roots to a module. You will need to create, then add a JBoss deployment structure file (jboss-deploymentstructure.
xml) to the pentaho-di.war.

  1. Use a text editor to create a new file named jboss-deployment-structure.xml.
  2. Copy the following code snippet to the jboss-deployment-structure.xml file.
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="resteasy" />
<subsystem name="jaxrs" />
<subsystem name="webservices" />
</exclude-subsystems>
<dependencies>
<module name="com.h2.hsqldb" />
<module name="org.postgresql" />
<module name="com.h2database.hsqldb" />
</dependencies>
</deployment>
</jboss-deployment-structure>
  1. Save and close the file.
  2. Use a zip extraction utility (such as 7-Zip, Winzip, or Archive) to view the contents of the pentaho-di.war file. Do not unzip or extract the contents of the file.
  3. Navigate to the WEB-INF directory and add the jboss-deployment-structure.xml file that you just created to it.
  4. Close the pentaho-di.war file. The zip extraction utility that you used might show a prompt that asks whether you would like to update the file in the pentaho-di.war archive. If this happens, confirm that you would like to do this.

Remove JNDI Resource References in JBoss

Because JBoss has its own mechanism for referencing JNDI data sources, the resource-references in the web.xml file located in the pentaho-di.war are not needed. You must remove these resource-references for the DI Server to operate properly.
  1. Navigate to the pentaho/server/data-integration-server/jboss/standalone/deployments directory.
  2. Use a zip extraction utility (such as 7-Zip, Winzip, or Archive) to view the contents of the pentaho-di.war file. Do not unzip or extract the contents of the file.
  3. Navigate to the WEB-INF directory and open the web.xml file in a text editor.
  4. Delete all <resource-ref> tagged entries including everything between the <resource-ref> and </resource ref> tags.
  5. Save and close the file.
  6. The zip extraction utility that you used might show a prompt that asks whether you would like to update the file in the pentaho-di.war archive. If this happens, confirm that you would like to do this.

Update JNDI Data Source Reference to Conform to JBoss Standards

Update these files so that referenced JNDI datasources conform to JBoss standards.

  1. Use a text editor to open the pentaho/server/data-integration-server/pentaho-solutions/system/quartz/quartz.properties file.
  2. Change the org.quartz.dataSource.myDS.jndiURL value to jboss/datasources/Quartz, then save and close the file.
  3. Use a text editor to open the pentaho/server/data-integration-server/pentaho-solutions/system/audit_sql.xml file.
  4. Change the JNDI value to jboss/datasources/Hibernate, then save and close the file.
  5. Open the pentaho/server/data-integration-server/pentaho-solutions/system/audit/dialects/postgresql folder. Use the text editor to open each file and make the following changes: 
  • Change <database>Audit</database> to <database>jboss/datasources/Audit</database>.
  • Change <database>Hibernate</database> to <database>jboss/datasources/Hibernate</database>.