기본구조 구현된 스프링 프로젝트

JDBC.zip



Servlet-context.xml


<!-- template -->

<beans:bean name="dataSource"

class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<beans:property name="driverClassName"                        value="oracle.jdbc.driver.OracleDriver" />

<beans:property name="url"

value="jdbc:oracle:thin:@localhost:1521:orcl" />

<beans:property name="username" value="scott" />

<beans:property name="password" value="tiger" />

</beans:bean>


<beans:bean name="template"

class="org.springframework.jdbc.core.JdbcTemplate">

<beans:property name="dataSource" ref="dataSource" />

</beans:bean>

<!-- END template -->



web.xml


 <resource-ref>

    <description>Connection</description>

    <res-ref-name>jdbc:/OracleDB</res-ref-name>

    <res-type>javax.sql.DataSource</res-type>

    <res-auth>Container</res-auth>

  </resource-ref>


pom.xml


<!-- JDBC Template -->

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-jdbc</artifactId>

<version>4.1.4.RELEASE</version>

</dependency>

<!-- END JDBC Template -->

블로그 이미지

왕왕왕왕

,