DS's『 행복합시다 』

Carpe Programming/jsp & spring & jstl

[jdbc] spring + jeus 환경에서 jeus connection pool 사용

nolite 2013. 1. 24. 15:21

* spring connection pool 사용시

 

[datasource-context.xml]

 

<!-- Properties Files -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:properties/jdbc.properties</value>
        </list>
    </property>
<bean>

 

<!-- DataSource Configuration -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
        <property name="initialSize" value="5"/>
        <property name="maxActive" value="20"/>
        <property name="minIdle" value="5"/>
        <property name="maxWait" value="3000"/>
        <property name="poolPreparedStatements" value="true"></property>
        <property name="maxOpenPreparedStatements" value="50"></property>
</bean>

 

 

-------------------------------------------------------------------------------------------------------

 

 

* jeus connection pool 사용시

 

[datasource-context.xml]

 

위 내용을 아래로 변경

 

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>DataSource</value>
    </property>
</bean>

 

 

[WEB-INF/jeus-web-dd.xml]

 

아래 내용 추가

 

<res-ref>
    <jndi-info>
        <ref-name>jdbc/DataSource</ref-name>
            <export-name>jdbc/DataSource</export-name>
    </jndi-info>
</res-ref>

 

 

[WEB-INF/web.xml]

 

아래 내용 추가

 

<resource-ref>
    <res-ref-name>jdbc/DataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

 

 

728x90