Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default url and credentials for H2DB?

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?

like image 902
Sharad Avatar asked Jan 03 '23 13:01

Sharad


1 Answers

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.

like image 108
Cepr0 Avatar answered Jan 13 '23 12:01

Cepr0