+

Search Tips   |   Advanced Search

Configure Apache Tomcat for MySQL manually

To manually set up and configure the MySQL database with the Apache Tomcat server, use the following procedure.

Complete the MySQL database setup procedure before continuing.

  1. Add the MySQL Connector/J JAR file to the $TOMCAT_HOME/lib directory.

  2. Prepare an XML statement that defines the data source, as shown in the following code example. Insert this statement in the server.xml file, as indicated in Configure Apache Tomcat manually.
      <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://mysqlserver: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://mysqlserver:3306/WLREPORT"/>

    Where worklight after username= is the user name of the MySQL server, worklight after password= is this user's password, and mysqlserver is the host name of the MySQL server (for example, localhost, if it is on the same machine).

    The database user listed in this step 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 Restricting database user permissions for runtime operations.


Parent topic: Configure the MySQL databases manually