H2 데이터베이스 설치

https://www.h2database.com/html/main.html

image.png

image.png

JDBC URL은 jdbc:h2:~/test로 수정하기.

테이블 생성 & 데이터 삽입

image.png

image.png


순수 JDBC

 implementation 'org.springframework.boot:spring-boot-starter-jdbc'
 runtimeOnly 'com.h2database:h2'

스프링 부트 데이터베이스 연결 설정 추가

<resources/application.properties>

 spring.datasource.url=jdbc:h2:tcp://localhost/~/test
 spring.datasource.driver-class-name=org.h2.Driver
 spring.datasource.username=sa