Skip to content

Instantly share code, notes, and snippets.

@tangblack
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangblack/4e5f757f1424679b6ffe to your computer and use it in GitHub Desktop.
Save tangblack/4e5f757f1424679b6ffe to your computer and use it in GitHub Desktop.
<?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" />
-->
<!--
Data source of MAD database.
maxActive: Connection Pool 同時所能建立的連線最大數量。若為負值,則無上限。
maxIdle: Connection Pool 同時所能允許閒置的連線最大數量。若為負值,則無上限。
maxWait: 等待可用 Connect 的 ms 數,超過時間就丟出例外。
removeAbandonedTimeout: 超過閒置秒數的連線會被移除。
dbcp config: http://commons.apache.org/proper/commons-dbcp/configuration.html
http://simon-tech.blogspot.tw/2012/02/tomcat-datasource.html
-->
<Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
maxActive="5"
maxIDle="4"
minIDle="4"
maxWait="10000"
initialSize="2"
removeAbandonedTimeout="300"
removeAbandoned="true"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jmxEnabled="true"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="${mysql_user}"
password="${mysql_password}"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://${mysql_server_ip}:3306/${database_name}"
connectionProperties="useUnicode=true;autoReconnect=true;characterEncoding=utf-8;"/>
</Context>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment