ABOUT ME

-

오늘 방문자
-
어제 방문자
-
전체
-
  • 데이터베이스 연동
    Spring 2018. 9. 4. 23:25

    MySQL, MariaDB


    pom.xml

    1
    2
    3
    4
    5
    6
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.31</version>
    </dependency>
     
    cs


    context-datasource.xml

    1
    2
    3
    4
    5
    6
    7
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
            <property name="url" value="jdbc:mysql://127.0.0.1:3306/데이터베이스명"/>
            <property name="username" value="디비계정아이디"/>
            <property name="password" value="비민번호"/>
    </bean>
     
    cs








    Oracle


    pom.xml

    1
    2
    3
    4
    5
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.4.0</version>
    </dependency>
    cs


    context-datasource.xml

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="core.log.jdbc.driver.OracleDriver"/>
            <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:xe"/>
            <property name="username" value="계정아이디" />
            <property name="password" value="비밀번호" />
            
            <property name="maxActive" value="100" />
            <property name="maxIdle" value="20" />
            <property name="maxWait" value="-1" />
            <property name="minIdle" value="2" />
    </bean>
     
    cs


    'Spring' 카테고리의 다른 글

    RequestMapping produces  (0) 2018.09.27
    Swagger란?  (0) 2018.09.17
    Spring Security 중복로그인 막기  (0) 2018.09.04
    Spring Security 태그  (0) 2018.09.04
    Mybatis - mapUnderscoreToCamelCase  (1) 2018.07.30

    댓글

Designed by Tistory.