To configure the Tomcat connection pool:
1, configure Conf/server.xml, create DataSource resources, and specify parameters for them;
2. Referencing resources in the web.xml;
3, the use of resources in JavaBean, servlet;
Server.xml File Contents
<!--path= "/tomcatdbpools" indicates what characters you want to use to access the site, the way the site is accessed by/tomcatdbpools end
Example: Http://localhost:8080/TomcatDbPools
Docbase= "Tomcatdbpools" where your components are placed without/then find from the WebApps directory
debug= "0" reloadable= "true" is fixed-->
<context path= "/tomcatdbpools" docbase= "Tomcatdbpools" debug= "0" reloadable= "true" >
<!--name Specifies the name of the resource Jndi of the resource pool to the connection pool Jdbc/tomcatdbpool1
Auth: Administrative permissions specify the manager for the management resource, which can be container or application
Type: Indicates the class name to which the resource belongs, what type of data source This example is SQL-->
<resource name= "Jdbc/tomcatdbpool1" auth= "Container" type= "Javax.sql.DataSource"/>
<resourceparams name= "Jdbc/tomcatdbpool1" >
The connection pool configuration parameter named for, that is Jdbc/tomcatdbpool
<!--Specifies the name of Dataresource factory-->
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!--Specify the maximum number of active connections in the connection pool 0 indicates unrestricted-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!--Specify the maximum number of idle connections 0 means unrestricted-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!--the maximum number of milliseconds to wait in the connection pool, 1 indicates infinite wait-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
User name and password for the <!--connection-->
<parameter>
<name>username</name>
<value></value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<!--driver JDBC Bridge-->
<parameter>
<name>driverClassName</name>
<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
</parameter>
URL of the <!--database-->
<parameter>
<name>url</name>
<value>jdbc:odbc:bookDSN</value>
</parameter>
</ResourceParams>
<!--we can also point to multiple resources so that it's OK to indicate which one is referenced in the web.xml.
The following is the use of SqlServer2000 driver to access the database
The premise is to copy SQL Server's drivers to the Common/lib directory under Tomcat-->
<resource name= "Jdbc/tomcatdbpool2" auth= "Container" type= "Javax.sql.DataSource"/>
<resourceparams name= "Jdbc/tomcatdbpool2" >
<!--Specifies the name of Dataresource factory-->
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!--Specify the maximum number of active connections in the connection pool 0 indicates unrestricted-->
<parameter>
<name>maxActive</name>
&n