H2 DBMS 파일모드 사용 시,
DB파일이 어느 위치에 생성되는지 알기 위해 정리한다.
아래 글은 H2 DBMS 매뉴얼에 있는 내용이다
Where are the Database Files Stored?
When using database URLs like jdbc:h2:~/test, the database is stored in the user directory.
For Windows, this is usually C:\Documents and Settings\ or C:\Users\.
If the base directory is not set (as in jdbc:h2:./test), the database files are stored in the directory where the application is started (the current working directory).
When using the H2 Console application from the start menu, this is /bin.
The base directory can be set in the database URL.
A fixed or relative path can be used.
When using the URL jdbc:h2:file:./data/sample, the database is stored in the directory data (relative to the current working directory).
The directory is created 424 of 428 automatically if it does not yet exist.
It is also possible to use the fully qualified directory name (and for Windows, drive name).
Example: jdbc:h2:file:C:/data/test
번역하자면,
- 파일 경로를 "jdbc:h2:~/"으로 할 경우, 유저 디렉토리에 저장됨
- "jdbc:h2:./"와 같이, 베이스 디렉토리가 지정되지 않을 경우, 현재 H2 DBMS가 실행된 경로에 저장됨
- 절대/상대경로 모두 사용될 수 있다
- 전체경로로 파일 경로를 설정할 수 있다
DB 파일이 저장되는 규칙은 아래와 같다

'Spring > Spring Boot' 카테고리의 다른 글
| [환경세팅] ③-① H2 DBMS 설치 및 환경세팅(설치 및 세팅) (0) | 2022.08.14 |
|---|---|
| Spring Boot 버전에 맞는 Dependency 버전을 찾는 방법 (0) | 2022.08.14 |
| [환경세팅] ② View Template Engine(Thymeleaf) 환경세팅 (0) | 2022.08.09 |
| 템플릿 엔진 종류 (0) | 2022.08.09 |
| Spring Boot에서 JSP 사용 시 제약사항 (0) | 2022.08.09 |
댓글