# Guide to OpenIG
5.1. Tomcat

Sidebar | Prev | Up | Next

### 5.1.1. Tomcat & MySQL/JNDI Configuration

If OpenIG accesses an SQL database you must configure Tomcat for JNDI. Once you have Tomcat configured you must add the jar for the database, and set up a JNDI data source and a reference to that data source in your web application. The following steps are for the MySQL Connector/J.

Download the MySQL JDBC Driver Connector/J. Add it to the class path by copying it to `$TOMCAT_HOME/lib`.

Add a JNDI data source for your MySQL server and database in `$TOMCAT_HOME/conf/context.xml`.

    <Resource name="jdbc/forgerock" auth="Container" type="javax.sql.DataSource"
     maxActive="100" maxIdle="30" maxWait="10000"
     username="admin" password="11111111" driverClassName="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost:3306/databasename"/>

Add a resource reference to the data source in `$TOMCAT_HOME/conf/web.xml`.

    <resource-ref>
        <description>MySQL Connection<description>
        <res-ref-name>jdbc/forgerock<res-ref-name>
        <res-type>javax.sql.DataSource<res-type>
        <res-auth>Container<res-auth>
    <resource-ref>