`
阿杜杜不是阿木木
  • 浏览: 21921 次
  • 性别: 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>


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

分享到:
评论

相关推荐

    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-8.5.66.tar.gz

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

    apache-tomcat-8.5.83.tar.gz

    - 此外,需要确保`conf/context.xml`和`conf/web.xml`配置文件中的敏感信息如数据库连接字符串被正确保护。 6. **应用部署**: - 将WAR文件放入 `webapps` 目录下,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-7.0.105.zip

    2. **conf**:配置文件存放处,如`server.xml`(服务器配置)、`web.xml`(全局Web应用配置)和`context.xml`(特定上下文配置)。 3. **lib**:存储Tomcat运行所需的库文件,包括Servlet和JSP API的JAR包。 4. **...

    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-7.0.109.tar.gz

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

    tomcat配置包,apache-tomcat-8.5.78.tar.gz jdk-linux-x64.tar.gz

    - 或者,在 `conf/server.xml` 的 `&lt;Host&gt;` 元素中添加 `&lt;Context&gt;` 配置来手动指定应用路径。 4. **安全管理**: - 可以在 `conf/tomcat-users.xml` 文件中添加用户和角色,实现基于角色的访问控制。 - 配置 `...

    apache-tomcat-9.0.53.tar.gz

    - **Manager App**:部署、卸载和管理应用程序,需要在`conf/context.xml`中启用并配置。 - **Host Manager**:管理服务器上的虚拟主机,适用于多站点部署。 8. **性能监控与调优** - **JMX(Java Management ...

    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-9.0.43.zip

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

    apache-tomcat-9.0.84.zip

    这个压缩包“apache-tomcat-9.0.84.zip”包含了Apache Tomcat版本9.0.84的所有组件和必要的配置文件,使得用户能够在其本地系统上搭建一个功能齐全的Java Web服务器。 Tomcat是Apache软件基金会Jakarta项目的一部分...

    apache-tomcat-8.5.16.tar.gz

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

Global site tag (gtag.js) - Google Analytics