コンテキスト情報の記述場所
記述場所
使い分け
ユーザデータベースの読み込み(Tomcat7)
/var/webapps/app/META-INF/context.xml
<?xml version="1.0"> <Context> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.MemoryRealm" pathname="/var/webapps/app/conf/user.xml" /> </Realm> </Context>
JDBCプーリング(Tomcat7)
/var/webapps/app/META-INF/context.xml
<?xml version="1.0"> <Context> <Resource name="jdbc/appname" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/dbname" username="username" password="password" initialSize="5" minIdle="5" maxIdle="10" maxActive="50" maxWait="5000" validationQuery="SELECT 1" validationQueryTimeout="5" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="1800000" numTestsPerEvictionRun="5" minEvictableIdleTimeMillis="86400000" removeAbandoned="true" removeAbandonedTimeout="3600" /> </Context>