habuma / spring-in-action-5-samples

Home for example code from Spring in Action 5.
Apache License 2.0
1.21k stars 1.04k forks source link

Chapter 3: h2-console does not find testdb #90

Closed VPERepos closed 4 years ago

VPERepos commented 4 years ago

While trying to log in under user:"sa" and password:"" I get an error message from h2-console:

Database "mem:testdb" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-200] 90149/90149

Is it necessary to make some steps, that are not mentioned in the book in order to create and access the testdb?

Screenshot from 2020-08-03 20-37-00

Thanks in advance for any hints!

VPERepos commented 4 years ago

One has to add these lines to 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 spring.h2.console.enabled=true

rakeshkumar4u commented 8 months ago

One has to add these lines to 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 spring.h2.console.enabled=true

still not resolving the issue

Bucephalus-lgtm commented 4 weeks ago

That should be there in application.properties but most importantly you must have the following dependency in your build.gradle file:

implementation 'org.springframework.boot:spring-boot-starter-jdbc'