jakarta-tomcat-5.5.7
1.web.xml的设置
<resource-ref>
  <description>OPDB JNDI for TOMCAT</description>
  <res-ref-name>jdbc/opdb</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>

2.cof/server.xml的配置(eg:C:\jakarta-tomcat-5.5.7\conf)。

<Resource name="jdbc/opdb" auth="Steve" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@172.16.208.190:1522:opdb" username="test" password="oracle" maxActive="20" maxIdle="10" maxWait="10000"/> 

3.web/META-INF/content.xml的配置。

<?xml version='1.0' encoding='utf-8'?>
<Context>
 <!-- note: the following resource name is set up to use the inet jdbc driver.  If you are
  using a different driver, then you will have to change the driverClassName.
  You will have to change the url (the ip and db identifier part), username and password
  entries for your environment.
  -->
 <Resource name="jdbc/opdb" auth="Container" type="javax.sql.DataSource" username="test" password="oracle"
  driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@172.16.208.190:1522:opdb" maxActive="20" maxIdle="10"
  maxWait="-1" validationQuery="SELECT 1 FROM DUAL"/>
</Context>
说明:我的tomcat版本是5.5.7。好像必须配置content.xml文件,但是配了这个文件,server.xml中的设置不起作用了。下面是各参数的说明:
driveClassName:JDBC驱动类的完整的名称;
maxActive:同时能够从连接池中被分配的可用实例的最大数;
maxIdle:可以同时闲置在连接池中的连接的最大数;
maxWait:最大超时时间,以毫秒计;
password:用户密码;
url:到JDBC的URL连接;
user:用户名称;
validationQuery:用来查询池中空闲的连接。