tomcat6.0 数据源的配置

来源:互联网 发布:stm8 ubuntu 编辑:程序博客网 时间:2024/05/25 20:01

tomcat数据源的配置方式有多种。

以下是其中一种配置方式:

各个版本的tomcat的数据源的配置也是有区别的,请注意我这里的tomcat版本是6.0的。

1,首先找到tomcat数据源的配置文件

tomcat安装路径\context.xml

例如我的是E:\tomcat6\conf

E:\tomcat就是我的tomcat的安装路径

2.配置文件如下:

<?xml version='1.0' encoding='utf-8'?><!-- The contents of this file will be loaded for each web application --><Context>   <Resource   name="jdbc/erp" auth="Container" type="javax.sql.DataSource"               maxActive="100" maxIdle="30" maxWait="10000"               username="root" password="root"                driverClassName="com.mysql.jdbc.Driver"               url="jdbc:mysql://127.0.0.1:3306/erp"/>               <!-- Default set of monitored resources -->    <WatchedResource>WEB-INF/web.xml</WatchedResource>    <!-- Uncomment this to disable session persistence across Tomcat restarts -->    <!--    <Manager pathname="" />    -->    <!-- Uncomment this to enable Comet connection tacking (provides events         on session expiration as well as webapp lifecycle) -->    <!--    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />    --></Context>


中间的注释可以省略,不过个人觉得留着更好。

原创粉丝点击