Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database not found, and IFEXISTS=true, so we cant auto-create it

Tags:

spring-boot

h2

I am getting error after opening the h2 database console. I enter database name but it is showing database not found error:

Database "C:/Users/Barlekar/onlineshoppings" not found, and IFEXISTS=true, so we cant auto-create it [90146-199] 90146/90146 (Help)

org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database "C:/Users/Barlekar/onlineshoppings" not found, and IFEXISTS=true, so we cant auto-create it [90146-199]

like image 946
sonal barlekar Avatar asked Aug 31 '25 18:08

sonal barlekar


2 Answers

If you are dealing with the Spring Boot project, please change the JDBC URL jdbc:h2:~/test to jdbc:h2:mem:testdb in the login page, which is the default URL configured by Spring Boot.

like image 61
Ivan Xue Avatar answered Sep 02 '25 11:09

Ivan Xue


Use a pre-2019 version of the H2 database dependency that auto-creates the database every time you run your standalone application. For example version 1.4.193. Your pom.xml should include this dependency:

<dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.4.193</version>
</dependency>
like image 44
Shant Dashjian Avatar answered Sep 02 '25 10:09

Shant Dashjian