Default url and credentials for H2DB?

跟風遠走 提交于 2019-12-19 10:35:08

问题


I have added H2DB in my springBoot application for unit testing purpose.

In application-test.properties I just added:

spring.datasource.name = h2db

spring.h2.console.enabled = true

Its working fine, saving the values.

But how it is working and how can I browse this DB?


回答1:


Default properties for H2 in Spring Boot application are:

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

So it's not necessary to add them to your application.properties - Spring Boot create this DB itself.


If you want to get access to your H2 DB right from your IDE you have to make this setup.



来源:https://stackoverflow.com/questions/45925770/default-url-and-credentials-for-h2db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!