0

I've cloned and installed the spring petclinic project

It's working correctly, but I don't understand if and how I can access the H2 db.

I see that in application.properties there is no username nor password, nor dbname.

Does this mean I can't access it from /h2-console? because maybe it's embedded?

Is there another setting (?server?) in order to access it? Which will be the configuration?

Glasnhost
  • 1,023
  • 14
  • 34

1 Answers1

0

I used this solution How to enable H2 Database Server Mode in Spring Boot

Basically, it removes runtime scope from h2 dependency in pom.xml and starts the H2 as a Bean in the Spring Application.

Only extra thing is that I have to read the Spring starting log to find the message

o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:27cca538-56b1-49d6-9b63-317e28c3e4a9'

And then use the jdbc URL in the console with user "sa" and empty password.

Don't understand it very much but it's working...

Glasnhost
  • 1,023
  • 14
  • 34