Tomcat5.5.x的JNDI配置(jakarta-tomcat-5.5.7)。


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:用来查询池中空闲的连接。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值