sliver__

[H2] database 생성 과정 및 connection 본문

Backend/Troubleshooting

[H2] database 생성 과정 및 connection

sliver__ 2024. 9. 20. 00:42
728x90

- 아래 blog 참조

https://bluayer.com/23

 

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

서론 H2 DB를 처음 사용할 때 맞이할 수 있는 문제다. 필자는 개인적으로 Spring boot를 사용할 때 테스트 용 디비로 H2를 사용하고 있었는데, 최근에 컴퓨터에서 직접 DB 조작할 일이 생겨 깔아서 사

bluayer.com

 

[원인]

- database 파일이 만들어지지 않았는데 connection을 요청하여 reject

- error message : org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database "C:/Users/{username}/test" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-232]

 

[해결 방안]

- JDBC URL row에 jdbc:h2:~/test 를 넣고 연결

- 이후 db 파일이 생성되었는지 확인

- JDBC URL row에 jdbc:h2:tcp://localhost/~/test를 넣어 db connection 시도

 

728x90
Comments