+

Search Tips   |   Advanced Search

Configure Liberty profile for DB2 manually

To manually set up and configure the DB2 database with WAS Liberty profile, use the following procedure.

Complete the DB2 Database Setup procedure before continuing.

  1. Add the DB2 JDBC driver JAR file (download it from DB2 JDBC Driver Versions, or fetch it from the directory DB2_INSTALL_DIR/java on the DB2 server) to $LIBERTY_HOME/wlp/usr/shared/resources/db2. If that directory does not exist, create it.

  2. Configure the data source in the $LIBERTY_HOME/wlp/usr/servers/worklightServer/server.xml file (worklightServer can be replaced in this path by the name of the server) as follows:
    <!-- Declare the jar files for DB2 access through JDBC. -->
    <library id="DB2Lib">
      <fileset dir="${shared.resource.dir}/db2" includes="*.jar"/>
    </library>
    <!-- Declare the runtime database -->
    <dataSource jndiName="worklight/jdbc/WorklightDS" transactional="false">
      <jdbcDriver libraryRef="DB2Lib"/>
      <properties.db2.jcc databaseName="WRKLGHT" currentSchema="WRKSCHM"
                          serverName="db2server" portNumber="50000"
                          user="worklight" password="password"/>
    </dataSource>
    <!-- Declare the reports database -->
    <dataSource jndiName="worklight/jdbc/WorklightReportsDS" transactional="false">
      <jdbcDriver libraryRef="DB2Lib"/>
      <properties.db2.jcc databaseName="WLREPORT" currentSchema="WLRESCHM"
                          serverName="db2server" portNumber="50000"
                          user="worklight" password="password"/>
    </dataSource>

    Where worklight after user= is the name of the system user with "CONNECT" access to the WRKLGHT and WLREPORT databases that you previously created, and password after password= is this user's password. If we defined either a different user name, or a different password, or both, replace these entries accordingly. Also, replace db2server with the host name of your DB2 server (for example, localhost, if it is on the same machine).

    The database user provided in step 2 does not need extended privileges on the databases. If we need to implement restrictions on the database, we can set here a user that has the restricted privileges listed in Restrict database user permissions for runtime operations.

    DB2 has a user name and password length limit of 8 characters for UNIX and Linux systems, and 30 characters for Windows.

    The jndiName attributes must depend on the context root that you select for the MobileFirst Server application, following the instructions in Configure the Liberty profile manually. If the context root is /app_context, use jndiName="app_context/jdbc/WorklightDS" and jndiName="app_context/jdbc/WorklightReportsDS" respectively.


Parent topic: Configure the DB2 databases manually