1. Tomcat server.xml 에 설정정보 추가
<GlobalNamingResources>
<!-- Oracle -->
<Resource name="jdbc/JNDI_ORACLE" auth="Container"
connectionProperties="SetBigStringTryClob=true"
driverClassName="oracle.jdbc.driver.OracleDriver"
maxActive="2"
maxIdle="2"
maxWait="-1"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@192.168.0.10:1521:ORCL"
username="TEST" password="TEST" />
<!-- MySQL -->
<Resource name="jdbc/JNDI_MYSQL" auth="Container"
driverClassName="com.mysql.jdbc.Driver"
maxActive="8" maxIdle="8" maxWait="-1"
type="javax.sql.DataSource"
url="jdbc:mysql://192.168.0.11:3306/TESTDB"
username="TEST" password="TEST" />
<GlobalNamingResources>
2. Tomcat context.xml 에 설정정보 추가
<Context>
<!-- Oracle -->
<ResourceLink name="jdbc/JNDI_ORACLE"
global="jdbc/JNDI_ORACLE"
auth="Container"
type="javax.sql.DataSource" />
<!-- MySQL -->
<ResourceLink name="jdbc/JNDI_MYSQL"
global="jdbc/JNDI_MYSQL"
auth="Container"
type="javax.sql.DataSource" />
</Context>
3. context-datasource.xml 설정 변경
파일위치 : /프로젝트명/src/main/resources/egovframework/spring/com/context-datasource.xml
[변경전]
<!--
<bean id="dataSource-oracle" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName}"/>
<property name="url" value="${Globals.Url}" />
<property name="username" value="${Globals.UserName}"/>
<property name="password" value="${Globals.Password}"/>
<property name="initialSize" value="0"/>
<property name="maxActive" value="2"/>
<property name="maxIdle" value="2"/>
<property name="minIdle" value="0"/>
<property name="maxWait" value="-1"/>
</bean>
<bean id="dataSource-mysql" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName}"/>
<property name="url" value="${Globals.Url}" />
<property name="username" value="${Globals.UserName}"/>
<property name="password" value="${Globals.Password}"/>
<property name="initialSize" value="0"/>
<property name="maxActive" value="2"/>
<property name="maxIdle" value="2"/>
<property name="minIdle" value="0"/>
<property name="maxWait" value="-1"/>
</bean>
-->
[변경후]
기존 bean 설정을 주석처리하고
<!-- Oracle -->
<bean id="dataSource-oracle" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/JNDI_ORACLE"/>
</bean>
<bean id="dataSource-mysql" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/JNDI_MYSQL"/>
</bean>
끝.
'JAVA' 카테고리의 다른 글
전자정부 cron 사용 (0) | 2024.11.21 |
---|---|
전자정부프레임워크 ajax사용을 위한 jsonView 설정 (0) | 2020.10.11 |
JSP htmlspecialchars (0) | 2019.01.08 |
JSP 확장자 구하기 (0) | 2019.01.08 |
[전자정부프레임워크 v3.7] 스프링 시큐리티 <sec:authorize access (0) | 2019.01.08 |