개발 공부

mac 에 h2 database 설치 + 연결 안될때

Summer_berry 2022. 6. 19. 20:39

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

 

H2 Database Engine

H2 Database Engine Welcome to H2, the Java SQL database. The main features of H2 are: Very fast, open source, JDBC API Embedded and server modes; in-memory databases Browser based Console application Small footprint: around 2.5 MB jar file size     Supp

www.h2database.com

여기에서 all platforms 클릭 후 zip 파일 받아지면 압축 해제하기

 

 

cmd창 켜서 

h2의 bin으로 이동
cd h2/bin

권한 부여
chmod 755 h2.sh

H2 실행
./h2.sh  -webAllowOthers

 

이렇게 다운로드 하던가 brew 를 쓰고계시다면

brew install h2

하면 바로 다운로드 된다.

 

 

 

Generic H2(Embedded)선택하고 

JDBC URL : jdbc:h2:~/test 

로 바꾸고 연결 누르기

 

 

만약

[H2] Database (디렉토리 경로) not found, either pre-create it or allow remote database creation

이렇게 뜬다면..

 

주소창에 localhost:8082 로 검색해서 들어가서 해보고 

안되면 삭제하고 다시 깔아보고

 

나는 다 안됐다.

 

이유는 연결 누르면 user에 test.mv.db 파일이 자동으로 생성 되야 되는데 없어서.. 

임의로 test.mv.db 파일을 생성해주니 연결이 되었다.