在appContext下配:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/audit2</value>
</property>
</bean>
然后在tomcat/conf下的server.xml中配置:
<Context path="访问名字" docBase="指向程序所在的路径" debug="0" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/audit2(这个名字是你在appContext里面配的java:comp/env/jdbc/后的这个名字)" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@172.16.184.251:1521:oradb"
username="shihua1017" password="111111" maxActive="100" maxIdle="10"
maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"/>
</Context>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/audit2</value>
</property>
</bean>
然后在tomcat/conf下的server.xml中配置:
<Context path="访问名字" docBase="指向程序所在的路径" debug="0" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/audit2(这个名字是你在appContext里面配的java:comp/env/jdbc/后的这个名字)" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@172.16.184.251:1521:oradb"
username="shihua1017" password="111111" maxActive="100" maxIdle="10"
maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"/>
</Context>