This paper takes the tomcat5.0 and Informix databases as examples to describe the configuration of Tomcat single Jndi data sources and multiple data sources.
One, tomcat configuration a Jndi data source method
The first step: in the C: "Tomcat 5.0" Server.xml in <Host>....</Host> Add the following content, note that:<defaultcontext> belong to <Host> The first level of the element below.
<DefaultContext>
<resource name = "Jdbc/testdb0_cs" auth= "Container"
Type= "Javax.sql.DataSource"/>
<resourceparams name= "Jdbc/testdb0_cs" >
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.informix.jdbc.IfxDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:informix-sqli://192.177.191.130:6666/testdb0_cs:INFORMIXSERVER=ccbhr_test</value>
</parameter>
<parameter>
<name>username</name>
<value>hrmis</value>
</parameter>
<parameter>
<name>password</name>
<value>hrmis</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>poolPrepareStatements</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<!--abandoned DB connections are removed and recycled-->
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<!--use the Removeabandonedtimeout parameter to set the number of seconds a DB connection has been idle before it is C Onsidered abandoned. -->
<value>60</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<!--Log a stack trace of the code which abandoned-->
<value>false</value>
</parameter>
</ResourceParams>
</DefaultContext>