Tomcat DBCP配置办法[Java编程]
本文“Tomcat DBCP配置办法[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
本文以tomcat5.0和informix数据库为例,介绍tomcat 单个JNDI数据源和大都据源的配置.
1、Tomcat配置一个jndi数据源办法
第一步:在C:"Tomcat 5.0"conf"server.xml中<Host>….</Host>中增添以下内容,注意:<DefaultContext>属于<Host>下的一级元素.
<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 considered abandoned. -->
<value>60</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<!-- Log a stack trace of the code which abandoned -->
<value>false</value>
</parameter>
</ResourceParams>
</DefaultContext>
以上是“Tomcat DBCP配置办法[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |