wfkjxy 发表于 2017-2-7 08:46:31

meta-inf下context-xml加载tomcat数据库连接xml

  context-xml内容
  <!-- The contents of this file will be loaded for each web application -->
<Context>
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Resource name="jdbc/pmlf" type="javax.sql.DataSource" 
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@192.168.0.209:1521:tsorcl"
    username="nwgh_rts"
    password="nwgh_rts"
    maxIdle="10"
    maxWait="5000"
    validationQuery=""
    DatabaseName="PMLF"
    maxActive="20" />
</Context>
  这样在tomcat启动项目时候会自动在tomcat/conf\Catalina\localhost目录下自动生成该项目连接数据库的xml
页: [1]
查看完整版本: meta-inf下context-xml加载tomcat数据库连接xml