1.Create a data source descriptor file named $CATALINA_HOME/conf/context.xml and insert the following lines:

<Context>

<Resource name="jdbc/mysqlDB" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://<IP_OR_NAME_OF_MYSQL_SERVER>:3306/<DATABASE_NAME>"

username="<DB_USERNAME>"

password="<DB_PASSWORD>" maxActive="10" maxIdle="10" maxWait="-1" /> </Context>

For example:

<Resource name="jdbc/mysqlDB" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://191.168.1.100:3306/osmsdb" username="osmsusr" password="osmspass" maxActive="10" maxIdle="10" maxWait="-1" />

2.Start the Tomcat web server by entering the following command:# $CATALINA_HOME/bin/startup.shConfiguring the MySQL Server

To configure the MySQL database, perform the following steps on the MySQL server:

1.Verify that the MySQL server is running properly by entering the following command:

# ps -efgrep mysqld

If the MySQL server is running, a process named mysqld displays in the output; otherwise, enter the following command:

#/etc/init.d/mysql start

2.If the database used in the Tomcat data source does not exist, create the database by entering the following command:

#mysqladmin -u root -p create osmsdbThe name of the database created in the command is osmsdb.

3.If the database user in the Tomcat data source does not exist, create the user and grant the appropriate privileges by entering the following commands from the mysql prompt:

mysql> grant all on osmsdb.* to osmsuser@'%.%.%.%' identified by \ 'osmsuser';mysql> flush privileges;

The user named osmsuser with the password osmspass is created and is granted all operation privileges on the database osmsdb.

Testing MySQL Database Connectivity

To test the connectivity between Tomcat and MySQL, perform the following steps on the Tomcat web server:

32