`
阿杜杜不是阿木木
  • 浏览: 21116 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

apache-tomcat中的context.xml文件数据库配置

 
阅读更多

更新日期20150902

1.Mysql数据库配置

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- 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" />
    -->
    <Resource name="jdbc/hrhxsms"
              auth="Container"
              type="javax.sql.DataSource"
              factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
              testWhileIdle="true"
              testOnBorrow="true"
              testOnReturn="false"
              validationQuery="select 1 from dual"
              validationInterval="30000"
              timeBetweenEvictionRunsMillis="30000"
              maxActive="80"
              maxIdle="20"
              minIdle="10"
              maxWait="10000"
              initialSize="1"
              removeAbandonedTimeout="60"
              removeAbandoned="true"
              logAbandoned="true"
              minEvictableIdleTimeMillis="30000"
              jmxEnabled="true"
              jdbcInterceptors=
"org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
              username="root"
              password="root"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://192.168.1.201:3306/hrhxsms"/>
</Context>

2.Oracle数据库配置

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- 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" />
    -->
   <Resource name="jdbc/hrhxmcc"
              auth="Container"
              type="javax.sql.DataSource"
              factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
              testWhileIdle="true"
              testOnBorrow="true"
              testOnReturn="false"
              validationQuery="select 1 from dual"
              validationInterval="30000"
              timeBetweenEvictionRunsMillis="30000"
              maxActive="80"
              maxIdle="20"
              minIdle="10"
              maxWait="10000"
              initialSize="1"
              removeAbandonedTimeout="60"
              removeAbandoned="true"
              logAbandoned="true"
              minEvictableIdleTimeMillis="30000"
              jmxEnabled="true"
              jdbcInterceptors=
"org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
              username="scott"
              password="scott"
              driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:@192.168.1.201:1521:ORCl"/>

</Context>


版权声明:本文为博主原创文章,未经博主允许不得转载。

分享到:
评论

相关推荐

    最新版linux apache-tomcat-8.5.66.tar.gz

    例如,你可以使用`logging.properties`文件配置日志级别和输出目的地。 在开发和部署Web应用时,将应用程序打包成WAR文件,然后将其放在`webapps`目录下。Tomcat会自动检测并部署这个文件。如果需要自定义部署行为...

    apache-tomcat-9.0.27-apache-tomcat-10.0.27.zip

    在部署和管理方面,Apache Tomcat提供了配置文件如server.xml、web.xml以及context.xml来控制其行为。例如,可以通过修改server.xml来配置端口号、线程池大小、连接器类型等。此外,Tomcat还支持通过管理界面(例如...

    最新版linux apache-tomcat-9.0.37.tar.gz

    6. **配置**:Tomcat的配置文件主要位于 `$CATALINA_HOME/conf` 目录下,如 `server.xml` 和 `context.xml`。根据需要,可以修改这些文件来配置端口号、JVM参数、连接器等。 7. **防火墙设置**:如果服务器有防火墙...

    apache-tomcat-8.5.64.tar.gz

    Tomcat的配置主要在`$CATALINA_HOME/conf`目录下的文件中进行,例如`server.xml`定义了服务器配置,包括端口、线程池等。`context.xml`则用于配置全局上下文。 7. **安全与权限** 在生产环境中,确保修改`$...

    apache-tomcat-8.5.100.tar.gz

    在本文中,我们将深入探讨Apache Tomcat 8.5.100这一特定版本的重要特性、安装与配置过程,以及如何利用它来托管Web应用。 首先,Apache Tomcat 8.5.x系列是基于Java EE 8规范的,这意味着它支持最新的Servlet 4.0...

    最新版linux apache-tomcat-9.0.54.tar.gz

    2. **conf**:配置文件目录,如`server.xml`定义了Tomcat服务器的配置,`context.xml`管理Web应用上下文,`web.xml`是全局的Servlet和JSP配置。 3. **lib**:包含了Tomcat运行所需的JAR文件和其他库。 4. **logs**:...

    最新版linux apache-tomcat-8.5.70.tar.gz

    5. **配置服务器**:默认情况下,Tomcat的配置文件位于`$CATALINA_HOME/conf`目录下,包括`server.xml`、`web.xml`等,可以根据需要进行修改以定制服务器的行为。 6. **部署应用**:将你的Java Web应用程序(WAR...

    apache-tomcat-8.5.56-src.tar.gz

    在本例中,我们讨论的文件"apache-tomcat-8.5.56-src.tar.gz"是Tomcat 8.5.56版本的源代码压缩包。 首先,让我们了解Tomcat的基本结构和组件。Tomcat的核心组件包括: 1. **Catalina**:这是Tomcat的主要部分,负责...

    apache-tomcat-7.0.91.tar.gz

    2. `conf`目录:存储Tomcat的配置文件,如`server.xml`(定义服务器配置)、`web.xml`(全局Web应用程序设置)和`context.xml`(单个应用程序上下文配置)。 3. `lib`目录:存放Tomcat运行所需的JAR文件,包括...

    apache-tomcat-8.5.71.tar.gz

    2. **conf**:这里存放了Tomcat的配置文件,如`server.xml`(定义服务器配置)、`web.xml`(全局Web应用配置)和`context.xml`(应用上下文配置)。 3. **lib**:包含Tomcat运行所需的库文件,包括JAR文件和其他...

    apache-tomcat-9.0.60.tar.gz

    2. **conf**:存放Tomcat的主要配置文件,如 `server.xml`(定义服务器的全局设置)、`context.xml`(应用上下文配置)和`web.xml`(部署描述符,定义web应用的规范)。 3. **lib**:包含运行Tomcat所需的JAR文件,...

    apache-tomcat-8.5.54.tar.gz

    3. **配置管理**:Tomcat的配置文件主要位于conf目录下,包括server.xml、context.xml、web.xml等,这些文件定义了服务器的行为、应用上下文以及Web应用的部署规范。 4. **部署**:可以通过将Web应用的WAR(Web ...

    apache-tomcat-8.5.16.tar.gz

    在本文中,我们将深入探讨Apache Tomcat 8.5.16版本的相关知识点,包括其功能、安装与配置、管理以及优化。 1. **Tomcat的功能** Apache Tomcat是一个实现了Java Servlet和Java EE Web容器规范的轻量级应用服务器...

    apache-tomcat-8.5.90-windows-x64.zip

    这些工具需要在`conf/context.xml`和`conf/tomcat-users.xml`中正确配置,以确保只有授权用户可以使用。 除了基本功能,Tomcat还可以与其他组件集成,如Apache HTTP服务器(通过mod_jk或mod_proxy_ajp模块),以...

    最新版windows apache-tomcat-9.0.68-windows-x64.zip

    2. **conf目录**:存放Tomcat的主要配置文件,例如`server.xml`(定义服务器配置)、`web.xml`(全局Web应用配置)和`context.xml`(特定应用上下文配置)。 3. **lib目录**:包含Tomcat运行时所需的JAR文件,如...

    apache-tomcat-8.5.99-windows-x64.zip

    - 或者,可以在`conf/server.xml`中的`Host`元素内添加`Context`元素来手动配置应用部署。 **7. 安全性** - 为了增强安全性,你需要为`conf/tomcat-users.xml`文件添加用户和角色,以限制对管理工具的访问。 - 配置...

    apache-tomcat-8.5.92.tar.gz

    在本文中,我们将深入探讨Apache Tomcat 8.5.92这一特定版本,了解其特点、功能以及如何进行安装和配置。 Apache Tomcat 8.5.x 系列是Tomcat的长期支持版本,它提供了对Java EE 7规范的全面支持。8.5.92是该系列的...

    apache-tomcat-9.0.34-fulldocs.tar.gz

    - **Config Reference**:详述了Tomcat的配置文件(如server.xml、context.xml等)中的元素和属性,是配置Tomcat的必备资料。 - **Javadocs**:包含了Tomcat所有公开API的详细文档,对于理解和使用Tomcat的API进行...

    apache-tomcat-9.0.43.zip

    - **conf**:存储所有配置文件,如server.xml、web.xml和context.xml,它们定义了Tomcat的行为和部署的应用程序的上下文。 - **lib**:包含运行Tomcat所需的JAR文件,包括Servlet和JSP API以及其他依赖库。 - **logs...

    apache-tomcat-8.5.64-windows-x64.rar

    2. `conf`:存储所有配置文件,如`server.xml`定义了服务器的全局配置,`web.xml`是全局的Web应用部署描述符,`context.xml`用于特定上下文的配置。 3. `lib`:存放Tomcat运行时所需的库文件,包括JARs和其他依赖项...

Global site tag (gtag.js) - Google Analytics