Configuring Apache Tomcat for DB2 manually

IBM Worklight V5.0.5. automatically configures your databases. However, if you are using an older version of IBM Worklight, or if you are experiencing problems with the automatic configuration process for the Apache Tomcat Server, you must manually set up and configure your DB2 database and then the Apache Tomcat Server for DB2. Complete the DB2 Database Setup procedure before continuing.

  1. Add the DB2 JDBC driver to the Tomcat lib directory:

    1. For the JDBC Version, modify the Worklight.properties file as follows:

        wl.db.url=jdbc:db2://<server>:50000/WRKLGHT
        wl.db.type=DB2
        wl.reports.db.type=DB2
        wl.reports.db.url=jdbc:db2://<server>:50000/WLREPORT

    2. For the JNDI Version, update the $TOMCAT_HOME/conf/web.xml file as follows:
      <web-app>
          ....
          ....
            <resource-ref>
              <res-ref-name>jdbc/WorklightDS</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
            </resource-ref>
      <resource-ref>
              <res-ref-name>jdbc/WorklightReportsDS</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
            </resource-ref>
      </web-app>
      

  2. Update the $TOMCAT_HOME/conf/context.xml file as follows:
    <Context>
       ...
      <Resource auth="Container"
      driverClassName="com.ibm.db2.jcc.DB2Driver"
      name="jdbc/WorklightDS"
      password="worklight"
      username="worklight"
      type="javax.sql.DataSource"
      url="jdbc:db2://server:50000/WRKLGHT"/>
    <Resource auth="Container"
      driverClassName="com.ibm.db2.jcc.DB2Driver"
      name="jdbc/WorklightReportsDS"
      password="worklight"
      username="worklight"
      type="javax.sql.DataSource"
      url="jdbc:db2://server:50000/WLREPORT"/>
    
     ...
    </Context>
    

    Where worklight after user= is the name of the system user with "CONNECT" access to the WRKLGHT database that you have previously created, and worklight after password= is this user's password. If you have defined either a different user name, or a different password, or both, replace worklight accordingly.

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

  3. Modify the worklight.properties file as follows:
    wl.db.jndi.name=java:comp/env/jdbc/WorklightDS 
    wl.db.type=DB2
    wl.reports.db.jndi.name=java:comp/env/jdbc/WorklightReportsDS
    


Parent topic Troubleshooting