Background on how Tomcat 6 data sources are configured can be found at http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
These instructions are for Tomcat 6. They will not work with Tomcat 4.x or 5.x.
Verify that the environment variable TOMCAT_HOME is set correctly.
Copy the JDBC driver JAR for your database type to Tomcat's lib directory ($TOMCAT_HOME/lib).
Define the data source for Tomcat by editing $TOMCAT_HOME/conf/web.xml and adding a resource reference as follows:
<resource-ref> <res-ref-name>jdbc/IDM_database</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
Define the data source for the Identity Manager webapp by editing the webapp deployment context (for example, $TOMCAT_HOME/conf/Catalina/localhost/idm.xml) and adding the data source resource as follows:
<Resource auth="Container" name="jdbc/IDM_database" type="javax.sql.DataSource" driverClassName="org.gjt.mm.mysql.Driver" password="waveset" maxIdle="5" maxWait="5000" username="waveset" url="jdbc:mysql://mysqlhost:3306/waveset" maxActive="150"/>
In the <resource-ref> element, the value of the <resource-ref name> element must be the same as the name attribute in the <Resource> element.
Be sure to change the attributes in the <Resource> element to match your environment.
Verify that the WSHOME and JAVA_HOME environment variables are set correctly.
Create an Identity Manager ServerRepository.xml file that points to the Tomcat data source:
lh setRepo -v -tDatastore -iorg.apache.naming.java.javaURLContextFactory -fjava:/comp/env/jdbc/IDM_database -n -o ServerRepository-datasource.xml
Change the -f location flag to the value you specified for the Resource name attribute, above. The prefix java:/com/env is specific to javaURLContextFactory and Tomcat. This is the JNDI prefix that the data source name is appended to.
Configure the Identity Manager webapp to use the data source by copying the new ServerRepository file in place. For example:
cp ServerRepository-datasource.xml $WSHOME/WEB-INF/ServerRepository.xml
When you copy the data-source-enabled ServerRepository.xml to $WSHOME/WEB-INF, the lh command will stop working. This is expected because lh uses ServerRepository.xml to connect to the Identity Manager repository. Since lh is not running in the Tomcat container, it cannot look up the data source in Tomcat's JNDI.
When a Tomcat data source is used by Identity Manager, the data source will typically be responsible for connection pooling. In this case Identity Manager connection pooling needs to be disabled. Edit the RepositoryConfiguration configuration object and set the disableConnectionPool attribute to true to allow the Tomcat data source to manage the connection pool.
The concurrent use of the lh utility and Tomcat data sources can be problematic because of the connection pool issue mentioned above. Tomcat data sources will want to control the connection pool, but the lh utility cannot use the Tomcat data source, so the value of the RepositoryConfiguration disableConnectionPool attribute will depend on the type of access, either JDBC or data source.