H2 DataBase 사용하기

G-NOTE·2021년 11월 7일
0

server/db

목록 보기
3/4

H2 데이터베이스 설치하기

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

  • 각자 환경에 맞는 파일을 설치한다.
/c/Program Files (x86)/H2/bin
$ ls
h2.bat  h2.sh*  h2-1.4.200.jar  h2w.bat

USER@DESKTOP-SVLNNKJ MINGW64 /c/Program Files (x86)/H2/bin
$ ./h2.sh
Error: Could not find or load main class org.h2.tools.Console
Caused by: java.lang.ClassNotFoundException: org.h2.tools.Console

USER@DESKTOP-SVLNNKJ MINGW64 /c/Program Files (x86)/H2/bin
$ ls -arlth
total 2.2M
-rw-r--r-- 1 USER 197121  105 1014  2019 h2w.bat
-rw-r--r-- 1 USER 197121 2.2M 1014  2019 h2-1.4.200.jar
-rwxr-xr-x 1 USER 197121  109 1014  2019 h2.sh*
-rw-r--r-- 1 USER 197121   98 1014  2019 h2.bat
drwxr-xr-x 1 USER 197121    0 113 05:59 ./
drwxr-xr-x 1 USER 197121    0 113 05:59 ../

USER@DESKTOP-SVLNNKJ MINGW64 /c/Program Files (x86)/H2/bin
$ ./h2.sh
Error: Could not find or load main class org.h2.tools.Console
Caused by: java.lang.ClassNotFoundException: org.h2.tools.Console

USER@DESKTOP-SVLNNKJ MINGW64 /c/Program Files (x86)/H2/bin
$ ./h2.bat
  • 실행하기 : ./h2.sh (윈도우는 h2.bat)

  • 데이터베이스 파일 생성 방법

  • jdbc:h2:~/test : 최초 한 번

  • ~/test.mv.db : 파일 생성 확인

  • 이후부터는 jdbc:h2:tcp://localhost/~/test 으로 접속

참조

https://inf.run/YRbn

profile
FE Developer

0개의 댓글