Spring JNDI 설정
Tomcat 5.5
wtp 1.5
jdk 5.0
$CATALINA_HOME/common/lib 에 DB관련 jar 파일을 복사한다.
server.xml 파일 변경
<Resource name="jdbc/myoracle" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@127.0.0.1:1521:mysid"
username="scott" password="tiger" maxActive="20" maxIdle="10"
maxWait="-1"/>
$PROJECT_HOME/WEB-INF/spring-sample-data-access.xml 파일변경
<bean id="data-source-sample-target" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/derby/sample</value>
</property>
</bean>
$PROJECT_HOME/WEB-INF/web.xml
<resource-ref>
<description>smaple DB connection</description>
<res-ref-name>jdbc/derby/sample</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>