This is my first spring boot application. I am trying to connect the database using h2-console. But when I trying to do it I am getting an error. The error is,
Database "/Users/MyName/test" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-200] 90149/90149 (Help)

I have shown h2-conosle image above. I did not use any code in application.property file. As well as I have used below mentioned dependency also.
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
First My port was 8080 Then also this not worked. After that, the port has been changed to 8082. even it not working.
First approach
The second and simpler approach
Configuring the h2 database url in application.properties without the need of spring randomly generating it.
spring.datasource.url=jdbc:h2:mem:testdb
Try creating the file test.mv.db in your home directory - worked for me. Seems H2 sometimes has trouble creating files for an unknown reason. Please comment if you know why.
E.g.
PS> ni c:\users\<your user>\test.mv.db
Found here in unselected answer to a similar question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With