spring boot:数据库 h2 的三种配置方式

H2 内存数据库

## jpa settings
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=false
spring.jpa.show-sql=true

H2 本地实体数据库

## datasource settings
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.password=demo
spring.datasource.url=jdbc:h2:tcp://127.0.0.1/~/jpa-h2
spring.datasource.username=demo
## jpa settings
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=false
spring.jpa.show-sql=true

H2 Web Console 访问数据库

## datasource settings
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.password=demo
spring.datasource.url=jdbc:h2:mem:jpa-h2
spring.datasource.username=demo
## h2 web console settings
spring.h2.console.enabled=true
## jpa settings
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=false
spring.jpa.show-sql=true