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

后端 未结 17 3020
不思量自难忘°
不思量自难忘° 2020-12-15 06:20

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/Barlek

17条回答
  •  情话喂你
    2020-12-15 06:57

    I have faced this issue and resolved in the following way

    • To use H2 Database - Your application should be running in JDK Environment, not JRE Environment , to change please use below steps :

      1. Right-click your project > properties
      2. Select “Java Build Path” on left, then “JRE System Library”, click Edit…
      3. Select "Workspace Default JRE"
      4. Click "Installed JREs"
      5. If you see JRE you want in the list select it (selecting a JDK is OK too)
      6. If not, click Search…, navigate to Computer > Windows C: > Program Files > Java, then click OK
      7. Now you should see all installed JREs, select the one you want
      8. Click OK/Finish a million times. I have used Georgie provided steps here -> https://stackoverflow.com/a/29640138


    • In H2 Login console, default URL come up by Spring Boot will be jdbc:h2:~/test, it should actually match with the spring boot application properties spring.datasource.url=jdbc:h2:mem:testdb so replace the url in the login console and click on connect I have used [Ivan Xue][2] provided steps here -> https://stackoverflow.com/a/56539107

    • Please clear target using mvn clean command and allow project to build if doesn't enforce using maven force update snapshot or mvn install and then start your spring boot app again to see the difference

提交回复
热议问题