Database

[H2 DB] 인메모리 방식 연결 방법 (미설치)

HSRyuuu 2023. 8. 18. 00:47

1. appliication.yml 파일에 아래와 같이 데이터소스 설정

spring:
  datasource:
    url: jdbc:h2:mem:test
    username: sa
    password:
    driverClassName: org.h2.Driver

(application.properties)

spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:test
spring.datasource.username=sa
spring.datasource.password=

2. 서버 구동 후 로그 확인

/h2-console url로 db 접근 가능


3. localhost:8080/h2-console 접근

설정한 url로 JDBC URL 설정 후 연결

 

 

-끝-

반응형