如何从Spring Boot连接到H2 Console?

时间:2019-11-03 22:03:46

标签: java spring spring-boot h2

driverClassName=org.h2.Driver
url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1
username=sa
password=sa

hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-drop
spring.h2.console.enabled=true

用户名或密码错误吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

在您的application.properties

spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

查看此tutorial