This contains some overlapping concepts from the Basics of JPA series.
- implementation: explicit dependenciy declaration, needed duing compiling but no need to be public.
- runtimeOnly: runs only during runtime (excluding compile time)
- testImplementation: runs during testing

build.gradle and application.properties.application.yml
spring:
datasource:
driver-class-name:{DB_name}
url: jdbc:h2:mem:{DB_location}
username: {user_name}
password: {password}
application.properties
spring.datasource.driver-class-name= {DB_name}
spring.datasource.url=jdbc:h2:mem:{DB_location}
spring.datasource.username={user_name}
spring.datasource.password={password}
build.gradle and application.properties.spring:
datasource:
driver-class-name:{DB_name}
url: jdbc:h2:{DB_location}
username: {user_name}
password: {password}
application.properties
spring.datasource.driver-class-name={DB_name}
spring.datasource.url=jdbc:h2:{DB_location}
spring.datasource.username={user_name}
spring.datasource.password={password}
First, run your program and copy the path H2 console written in your application.yml file.
application.yml
spring:
application.name: jdbc
# H2 Database 설정
datasource:
driver-class-name: org.h2.Driver
url: 'jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE' # H2 DB 연결 주소 (In-Memory Mode)
#url: 'jdbc:h2:~/test' # H2 DB 연결 주소 (Embedded Mode)
username: sa # H2 DB 접속 ID (사용자 지정)
password: # H2 DB 접속 PW (사용자 지정)
# H2 Console 설정
h2:
console: # H2 DB를 웹에서 관리할 수 있는 기능
enabled: true # H2 Console 사용 여부
path: /h2-console # H2 Console 접속 주소
In a web-browser type: http://localhost:8080/{h2-console path} which in this case is http://localhost:8080/h2-console
Then, the following will appear:

MyBatis is a Java framework that helps developers interact with databases more easily. It simplifies the process of sending SQL queries to the database and retrieving data by allowing you to map database records directly to Java objects.
