How to connect SpringBoot Application to H2 database ? H2 DB Configuration in SpringBoot

Опубликовано: 13 Март 2025
на канале: SJ Programming Solutions
2,760
43

#springbootprojects #springboot #springboottutorial

Hello All,

In this video we will se how to connect springboot application to h2 database

Please find below configuration which we need to add in application.properties file.

spring.application.name=H2DatabaseDemo
spring.datasource.url=jdbc:h2:file:/Users/shital/h2-db-data/mydatabase
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=pass123
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true

spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true

Thank you !