Dev/JPA
h2 초기 연결시 JdbcSQLNonTransientConnectionException 에러 해결 방법
린네의
2023. 12. 6. 02:30
maven 기반의 프로젝트에 대해
jpa 사용을 위해 persistence.xml 파일을 생성하고 h2 도 다운로드 후 실행되는 것 까지 확인 했는데, main 을 실행하니
Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database "/Users/gwongahyeon/test" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-224]
오류가 발생했다.
에러만 보기에도 test 파일이 필요한데 못찾는다는 것 같아서, /Users/gwongahyeon/ 로 이동해보니 역시나 test 파일이 없었다.
강의에서 따로 생성하라는 말이 없는걸로봐서 자동생성이 되어야 하는 것 같은데 강의 버전과 db 버전이 달라서 그런지 몰라도 나는 무슨짓을 해도 저 파일이 생기지 않아서 결국 저 위치에 'test.mv.db' 파일을 직접 생성했다.

파일을 생성하고 나니 위와같이 정상적으로 http://localhost:8082/ 에 접속 되는 것을 확인할 수 있었다.