日期:2014-05-16 浏览次数:20444 次
在Spring中配置数据库连接,使用JNDI。 <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" destroy-method="close"> <property name="jndiName"> <value>jdbc</value> </property> </bean> <bean id="dataSourceHQ" class="org.springframework.jndi.JndiObjectFactoryBean" destroy-method="close"> <property name="jndiName"> <value>hq</value> </property> </bean> <!-- iBATIS sqlMapClient config --> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation"> <value>classpath:/config/sqlConfig.xml</value> </property> <property name="dataSource" ref="dataSource"/> <property name="lobHandler"> <ref local="oracleLobHandler" /> </property> </bean> <bean id="sqlMapClientTTDate" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation"> <value>classpath:/config/sqlConfigHQ.xml</value> </property> <property name="dataSource" ref="dataSourceHQ"/> <property name="lobHandler"> <ref local="oracleLobHandler" /> </property> </bean>