tomcat6.0配置jndi

1.在..\apache-tomcat-6.0.0\apache-tomcat-6.0.0\conf\context.xml中
加入
<Resource name="jdbc/Project" auth="Container"
                 type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
                 url="jdbc:oracle:thin:@IP:1521:oracle"
                 username="test" password="test" maxActive="20" maxIdle="10"
                 maxWait="-1"/>
2.在\apache-tomcat-6.0.0\apache-tomcat-6.0.0\lib加入oracle-jdbc-1.4-9.2.0.6.jar
相应的数据库驱动包
3.配置web.xml
   <!-- -->
<resource-ref>
<description></description>
<res-ref-name>jdbc/Project</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
4.配置applicationContext.xml
<!---->
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/Project"/>
</bean>

ok!

你可能感兴趣的:(apache,oracle,tomcat,xml,jdbc)