hanker

Spring boot - application.properties Oracle DB 설정 (properties/yml) 본문

SPRING

Spring boot - application.properties Oracle DB 설정 (properties/yml)

hanker 2024. 10. 10. 19:09

pom.xml 

        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>19.8.0.0</version>
        </dependency>

 

1. application.properties 일 경우

# IP:PORT:SID
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:orcl
# ID
spring.datasource.username=hanker
# PW
spring.datasource.password=hanker
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver

# HikariCP 커넥션 풀 설정 (기본값)
spring.datasource.hikari.maximum-pool-size=10

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle12cDialect

 

2. application.yml 일 경우

spring:
  datasource:
    url: jdbc:oracle:thin:@localhost:1521:orcl # IP:PORT:SID
    username: hanker
    password: hanker
    driver-class-name: oracle.jdbc.OracleDriver
    hikari:
      maximum-pool-size: 10

  jpa:
    hibernate:
      ddl-auto: update
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle12cDialect

 

끝.