강의

멘토링

커뮤니티

Inflearn Community Q&A

haguri's profile image
haguri

asked

[Revised 2023-11-27] Developing RESTful Web Services using Spring Boot 3.x

Adding Dependency and Entity Setting for JPA

JDBC URL

Written on

·

610

21

spring:

...

datasource:
url: jdbc:h2:mem:testdb
jpa:
show-sql: true
h2:
console:
enabled: true

위 처럼 datasource 부분을 추가해줘야

/h2-console 에서 정상적으로 Connect 됩니다.

rest-apispring-boot

Answer 4

3

Dowon Lee님의 프로필 이미지
Dowon Lee
Instructor

안녕하세요, 이도원입니다. 

답변이 늦어 죄송합니다. 

스프링부트에서는 내부적으로 아래와 같은 정보를 자동으로 생성합니다. 

  • Driver Class : org.h2.Driver
  • JDBC URL : jdbc:h2:mem:testdb
  • Username : sa
  • Password :

그러나, 접속 시

Database "mem:testdb" not found, either pre-create it or allow remote database creation (not recommended in secure environments)

위와 같은 오류가 발생한다면, h2의 버전을 낮춰서(1.3.x 또는 1.4.197 이하) 사용하시기 바랍니다. 최신 h2 버전에서는 데이터베이스를 미리 생성하는 것을 방지하도록 설정 되어 있습 니다. (https://github.com/h2database/h2database/issues/1901)

감사합니다.

0

감사합니다

 

0

감사합니다~

0

감사합니다 하구리님 

haguri's profile image
haguri

asked

Ask a question