1、Tomcat部署应用方式 1 2 3 4 5 6 <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="D:\Publish\WebContent" crossContext="true" cacheMaxSize="120485760"> <!-- 在Host中添加上下文节点即可,指导项目文件路径docBase属性即可 --> </Context> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> 2、Tomcat配置MySQL数据源 1 2 3 4 5 6 <!-- 将Resource节点放到Context节点下 --> <Resource auth= "Container" driverClass= "com.mysql.jdbc.Driver" maxPoolSize= "50" minPoolSize= "2" acquireIncrement= "2" name= "jdbc/baseds" user= "username" password= "*********" factory= "org.apache.naming.factory.BeanFactory" type= "com.mchange.v2.c3p0.ComboPooledDataSource" idleConnectionTestPeriod= "10" jdbcUrl= "jdbc:mysql://192.168.0.6:3306/db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull" /> 3、Tomcat配置Oracle数据源 1 2 3 4 5 6 <!-- 将Resource节点放到Context节点下 --> <Resource auth= "Container" driverClass= "oracle.jdbc.driver.OracleDriver" maxPoolSize= "50" minPoolSize= "2" acquireIncrement= "2" name= "jdbc/baseds" user= "username" password= "********" factory= "org.apache.naming.factory.BeanFactory" type= "com.mchange.v2.c3p0.ComboPooledDataSource" idleConnectionTestPeriod= "10" jdbcUrl= "jdbc:oracle:thin:@192.168.0.20:1521:dbs2" />