Previous Topic: Creating a JNDI ConnectionNext Topic: IBM WebSphere


Apache Tomcat (C7_CJNDI_TOMCAT)

To create a JNDI connection in Apache Tomcat:

  1. Collect the following database-specific information:
  2. Take a backup of server.xml file present in the TOMCAT-HOME/conf directory.
  3. Open the server.xml file present in the TOMCAT-HOME/conf directory.
  4. Use the information that you collected in Step 1 to add an entry in the following format for defining the data source within the GlobalNamingResources tag:

    <Resource name="datasource-name" auth="Container" type="javax.sql.DataSource" username="user-id" password="password" driverClassName="JDBC-driver-class" url="jdbc-url" maxWait="30000" maxActive="32" maxIdle="4" initialSize="4" timeBetweenEvictionRunsMillis="600000" minEvictableIdleTimeMillis="600000"/>

  5. Save and close the server.xml file.
  6. Take a backup of the context.xml file present in the TOMCAT-HOME/conf directory.
  7. Open the context.xml file present in the TOMCAT-HOME/conf directory.
  8. Use the information that you entered in Step 4 to add an entry in the following format for defining the data source within the Context tag. The data source name that you specify in this step must be the same as the data source name that you specify in Step 4.

    <ResourceLink global="datasource-name" name="datasource-name" type="javax.sql.DataSource"/>

  9. Save and close the context.xml file.