日期:2014-05-17 浏览次数:20901 次
<?xml version='1.0' encoding='utf-8'?> <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource url="jdbc:oracle:thin:@192.168.0.5:1521:test" driverClassName="oracle.jdbc.OracleDriver" password="username" username="password" logAbandoned="true" maxWait="10000" maxIdle="30" maxActive="50" type="javax.sql.DataSource" auth="Container" name="jdbc/test" testOnBorrow="true" validationQuery="select 1 from dual" /> </Context>
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> ... ... <resource-ref> <description>test</description> <res-ref-name>jdbc/test</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/test"></property> </bean> ... ... <beans>