본문 바로가기

Develop/Back-End

[Spring Boot] H2 in memory DB 사용 시 Database "C:/Users/사용자/test" not found, either pre-create it or allow remote database creation (not recommended in secure environments) 오류 발생 / 해결 방법

Webflux 공부 중 

Database를 사용해야 되는 상황이 생겨

서버 구성하긴 번거롭고.. 예전 기억을 살려 간단하게  H2 Database 사용하려고 하는데

오류가 발생해버렸다.. 🤕

 

오류 상세 내용을 확인 하면 

예전에 사용 했을 때는 Database를 자동으로 생성 했던 걸로 기억하는데 

공식문서를 확인해보니 보안상 이유로 더 이상 자동으로 생성하지 않는다고 한다.

 

문제해결

 > database를 사전 생성 해서 사용

Database를 생성하는 방법은 아래 링크를 참고

> 문서 볼 시간도 아깝다.. 당장 해결만 하고자 한다면

 해당 경로에 메모장을 만든 후 파일명을 test.mv.db 로 수정 후 저장하면 해결된다. (test는 커넥션팩토리에서 설정한 스키마명)

 

 

https://h2database.com/html/tutorial.html#creating_new_databases

 

Tutorial

  Tutorial Starting and Using the H2 Console Special H2 Console Syntax Settings of the H2 Console Connecting to a Database using JDBC Creating New Databases Using the Server Using Hibernate Using TopLink and Glassfish Using EclipseLink Using Apache Active

h2database.com

 

 

database can't auto create in 1.4.200 if not schema and data 

관련 Issue

https://github.com/h2database/h2database/issues/2900

 

database can't auto create in 1.4.200 if not schema and data · Issue #2900 · h2database/h2database

I have a SpringBoot maven project. JDK8, SpringBoot 1.4.4.RELEASE My pom.xml is <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.4.200</version> </dependency> <...

github.com

 

 

H2 Database Github

https://github.com/h2database/h2database

 

GitHub - h2database/h2database: H2 is an embeddable RDBMS written in Java.

H2 is an embeddable RDBMS written in Java. Contribute to h2database/h2database development by creating an account on GitHub.

github.com

 

Webflux 환경일 경우

https://github.com/r2dbc/r2dbc-h2

 

GitHub - r2dbc/r2dbc-h2: R2DBC H2 Implementation

R2DBC H2 Implementation. Contribute to r2dbc/r2dbc-h2 development by creating an account on GitHub.

github.com

 

반응형