Step 2: Modify JDBC connection information in the Tomcat 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 for your operating environment.

CAUTION:

If you have a user or password, 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 the connection string for your Pentaho Repository database.

  2. Navigate to the server/pentaho-server/tomcat/webapps/pentaho/META-INF directory and open the context.xml file with any text editor.

  3. Add the following code to the file if it does not already exist.

    <Resource name="jdbc/Hibernate" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            maxActive="20" maxIdle="10" maxWait="10000"
            initialSize="0" username="hibuser" password="password"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
            url="jdbc:sqlserver://localhost:1433;DatabaseName=hibernate;encrypt=true;trustServerCertificate=false"
            validationQuery="select 1"/>
    <Resource name="jdbc/Audit" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            maxActive="20" maxIdle="10" maxWait="10000"
            initialSize="0" username="hibuser" password="password"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"        
            url="jdbc:sqlserver://localhost:1433;DatabaseName=hibernate;encrypt=true;trustServerCertificate=false"
            validationQuery="select 1"/>
    <Resource  name="jdbc/Quartz" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            initialSize="0" maxActive="20" maxIdle="10" maxWait="10000"
            testOnBorrow="true" username="pentaho_user" password="password"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
            url="jdbc:sqlserver://localhost:1433;DatabaseName=quartz;encrypt=true;trustServerCertificate=false"
            validationQuery="select 1"/>
    <Resource name="jdbc/pentaho_operations_mart" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            maxActive="20" maxIdle="10" maxWait="10000"
            initialSize="0" username="pentaho_operations_mart" password="password"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
            url="jdbc:sqlserver://localhost:1433;DatabaseName=pentaho_operations_mart;encrypt=true;trustServerCertificate=false"
            validationQuery="select 1"/>
    <Resource name="jdbc/PDI_Operations_Mart" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            maxActive="20" maxIdle="10" maxWait="10000"
            initialSize="0" username="pentaho_operations_mart" password="password"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
            url="jdbc:sqlserver://localhost:1433;DatabaseName=pentaho_operations_mart;encrypt=true;trustServerCertificate=false"
            validationQuery="select 1"/>
    <Resource name="jdbc/live_logging_info" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            initialSize="0" maxActive="20" maxIdle="10"
            maxWait="10000" username="dilogs_user" password="password"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
            url="jdbc:sqlserver://localhost:1433;DatabaseName=pentaho_dilogs;encrypt=true;trustServerCertificate=false"
            validationQuery="select 1"/>
    <Resource name="jdbc/SampleData" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            maxActive="20" minIdle="0" maxIdle="5" initialSize="0" maxWait="10000"
            username="pentaho_user" password="password" driverClassName="org.hsqldb.jdbcDriver"
            url="jdbc:hsqldb:hsql://localhost/sampledata" validationQuery="select 1"/>
    <Resource name="jdbc/SampleDataAdmin" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            maxActive="20" minIdle="0" maxIdle="5" initialSize="0" maxWait="10000"
            username="pentaho_admin" password="password" driverClassName="org.hsqldb.jdbcDriver"
            url="jdbc:hsqldb:hsql://localhost/sampledata" validationQuery="select 1"/>
    <Resource name="jdbc/jackrabbit" auth="Container" type="javax.sql.DataSource"
            factory="org.pentaho.di.core.database.util.DecryptingDataSourceFactory"
            maxActive="20" minIdle="0" maxIdle="5" initialSize="0"
            maxWait="10000" username="jcr_user" password="password"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
            url="jdbc:sqlserver://localhost:1433;DatabaseName=jackrabbit;encrypt=true;trustServerCertificate=false"
            validationQuery="select 1"/>

    Note: Depending on the configuration of your MS SQL Server, you could set trustServerCertificate=true in the above XML code samples. See Connecting with encryption for details.

  4. Modify the username, password, driver class information, IP address (or domain name), and port numbers to match the correct values for your environment.

  5. Comment out any resource references that refer to other databases.

  6. Verify that the validationQuery parameter for your database is set to: validationQuery="select 1".

  7. Save the context.xml file, then close it.

Last updated

Was this helpful?