Tomcat JNDI简单配置

server.xml:
<GlobalNamingResources>
  .............
<Resource name="PortalONEServiceDB" auth="Container" type="javax.sql.DataSource"
   initialSize="5" minIdle="5" maxActive="5" maxIdle="5" maxWait="100"
   username="ptl0621" password="tdnbeiD34eRKg0Gpx0FqCw==" driverClassName="oracle.jdbc.driver.OracleDriver"
   url="jdbc:oracle:thin:@10.163.195.215:1521:portaldb"
   validationQuery="select 1 from dual" testOnBorrow="true" />
Spring:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
            <value>java:/comp/env/PortalONEServiceDB</value>
        </property>
</bean>

你可能感兴趣的:(java)