๋ฐ์ํ
H2 database ์ค์น
https://www.h2database.com
๊ถํ ์ฃผ๊ธฐ:
chmod 755 h2.sh
์คํ:
./h2.sh
๋ฐ์ดํฐ๋ฒ ์ด์ค ํ์ผ ์์ฑ ๋ฐฉ๋ฒ
jdbc:h2:~/test
(์ต์ด ํ๋ฒ)~/test.mv.db
ํ์ผ ์์ฑ ํ์ธ- ์ดํ๋ถํฐ๋
jdbc:h2:tcp://localhost/~/test
์ด๋ ๊ฒ ์ ์
ํ ์ด๋ธ ์์ฑํ๊ธฐ
ํ
์ด๋ธ ๊ด๋ฆฌ๋ฅผ ์ํด ํ๋ก์ ํธ ๋ฃจํธ์ sql/ddl.sql
ํ์ผ์ ์์ฑ
drop table if exists member CASCADE;
create table member (
id bigint generated by default as identity,
name varchar(255),
primary key (id)
);
ํ๊ฒฝ์ค์ build.gradle
ํ์ผ์ jdbc, h2
๋ฐ์ดํฐ๋ฒ ์ด์ค ๊ด๋ จ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ถ๊ฐ
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
๋ฐ์ํ