728x90
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
                           http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd">

    <!-- DB서버1 :: SID 환경 -->
    <bean id="dataSourceBase" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="net.sf.log4jdbc.sql.jdbcapi.DriverSpy"/>
        <property name="url" value="jdbc:log4jdbc:oracle:thin:@111.111.111.11:1521:ㅁㅁDB"/>
        <property name="username" value="ㅁㅁ"/>
        <property name="password" value="ㅁㅁ"/>
        <property name="testOnBorrow" value="true"/>
        <property name="validationQuery" value="select * from dual"/>
    </bean>

    <!-- DB서버2 :: ServiceName 환경 -->
    <bean id="dataSourceB" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="net.sf.log4jdbc.sql.jdbcapi.DriverSpy"/>
        <property name="url" value="jdbc:log4jdbc:oracle:thin:@//111.111.111.11:1521/ㅁㅁDB"/>
        <property name="username" value="ㅁㅁ"/>
        <property name="password" value="ㅁㅁ"/>
        <property name="testOnBorrow" value="true"/>
        <property name="validationQuery" value="select * from dual"/>
    </bean>

    <!-- JdbcTemplate for DB -->
    <bean id="jdbcTemplateBase" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSourceBase"/>
    </bean>
</beans>
728x90

+ Recent posts