Tomcat 设置ROOT工程。

本文介绍如何在Tomcat server.xml文件的Host节点中配置数据库连接池。具体包括两个DataSource资源,分别用于MySQL和SQL Server数据库,同时设置了相关参数如最大活动连接数、最大空闲连接数等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

tomcat server.xml文件 Host节点中添加设置连接池和ROOT BASE工程.



<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="D:\work\tomcatv6\webapps\MYPROJECTNAME" debug="0" reloadable="true" crossContext="true" privileged="true">
<Resource name="jdbc/***"
auth="Container"
type="javax.sql.DataSource"
url="jdbc:mysql://*****:3306/***?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull"
initialSize="2"
maxActive="20"
maxIdle="20"
minIdle="2"
maxWait="100"
removeAbandoned="true"
username="root"
password=""
poolPreparedStatements="true"
defaultAutoCommit="false"
driverClassName="com.mysql.jdbc.Driver"
/>

<Resource name="jdbc/omaha"
auth="Container"
type="javax.sql.DataSource"
url="jdbc:jtds:sqlserver://*****:1433/*****"
initialSize="1"
maxActive="1"
maxIdle="20"
minIdle="2"
maxWait="100"
removeAbandoned="true"
username="******"
password="******"
poolPreparedStatements="true"
defaultAutoCommit="false"
driverClassName="net.sourceforge.jtds.jdbc.Driver"
/>
</Context>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->

<!-- Access log processes all example.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->

</Host>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值