Configuring Apache Tomcat for MySQL 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 MySQL database and then the Apache Tomcat Server for MySQL. Complete the MySQL database setup procedure before continuing.

  1. Copy the Connector/J .jar file into the $TOMCAT_HOME/lib directory.

    For JDBC, modify worklight.properties as follows:

    wl.db.type=MYSQL
    wl.db.url= jdbc:mysql://localhost:3306/WRKLGHT
    wl.reports.db.type=MYSQL
    wl.reports.db.url=jdbc:mysql://localhost:3306/WLREPORT
    wl.db.username=worklight
    wl.db.password=worklight
    reports.exportRawData=true
    

    For JNDI, edit 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 name="jdbc/WorklightDS" 
    auth="Container" 
    type="javax.sql.DataSource"
          maxActive="100" 
    maxIdle="30" 
    maxWait="10000"
          username="worklight" 
    password="worklight" 
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/WRKLGHT"/>
    <Resource name="jdbc/WorklightReportsDS" auth="Container" 
    type="javax.sql.DataSource"
    maxActive="100" 
    maxIdle="30" 
    maxWait="10000"
    username="worklight" 
    password="worklight"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/WLREPORT"/>
    
     ...
    </Context>
    

  3. In the worklight.properties file, update the following properties:
    wl.db.jndi.name=java:comp/env/jdbc/WorklightDS
    wl.db.reports.jndi.name=java:comp/env/jdbc/WorklightReportsDS
    

    The worklight.properties file is in worklight.war.

  4. Copy the worklight.war file to $TOMCAT_HOME/webapps.

  5. Copy the worklight-jee-library.jar file to $TOMCAT_HOME/lib.


Parent topic Troubleshooting


+

Search Tips   |   Advanced Search