h2 데이터베이스 Springboot에서 설정하는 방법
4724 단어 H2SpringbootH2
build.gradle 설정
runtimeOnly 'com.h2database:h2'
application yml 설정
spring:
h2:
console:
enabled: true
jpa:
database-platform: org.hibernate.dialect.H2Dialect
open-in-view: false
hibernate:
ddl-auto: create
properties:
hibernate:
show_sql: true
format_sql: true
- 초기 설정
spring:
h2:
console:
enabled: true
- /h2-console 디폴트 설정
datasource:
url: jdbc:h2:mem:testdb
driver-class-name: org.h2.Driver
hikari:
username: sa
password:
- h2 - jpa 연결 설정
jpa:
database-platform: org.hibernate.dialect.H2Dialect
open-in-view: false
hibernate:
ddl-auto: create
properties:
hibernate:
show_sql: true
format_sql: true
프로젝트를 실행시 Run console에 JDBC URL
이 나오게 되있다.
H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:26b18340-687a-410e-9653-c8c5acf95356'
그리고
http://localhost:8080/h2-console 접속
Run console에 나온 JDBC URL을 입력한다.
드디어 h2 웹콘솔로 들어가진다.
Author And Source
이 문제에 관하여(h2 데이터베이스 Springboot에서 설정하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@mooh2jj/h2-데이터베이스-설정하는-방법저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)