tomcat的conf/server.xml 配置
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="/platformproxy" docBase="C:\Users\King\Documents\Eclipse2013Workspace\platformproxy\WebRoot" > <Manager pathname=""/> <Resource name="jdbc/pcis" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" maxActive="25" maxIdle="100" maxWait="1000" username="U_IPCIS_POLICY_PLATFORM" password="11" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.15.22.117:1521/DWXDBDEV"/> </Context> </Host>
java SpringBean的配置
<bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>${MY_DATA_SOURCE_JNDI}</value> </property> </bean>
其中{MY_DATA_SOURCE_JNDI}指向某个properties文件
#localhost tomcat下面要带java:comp/env/ MY_DATA_SOURCE_JNDI=java:comp/env/jdbc/platformproxy #development test test_production weblogic下面不用带java:comp/env/ #MY_DATA_SOURCE_JNDI=jdbc/platformproxy #production #MY_DATA_SOURCE_JNDI=jdbc/pcis
时间: 2024-10-25 15:22:45