H2 Database not found error: 90146. H2 database is not created on start

后端 未结 8 1677
无人及你
无人及你 2021-01-19 01:55

Just created a simple spring-boot project from the spring initializer. I went to add a local h2 db for testing and am unable to login. Seems that it cannot create the test d

相关标签:
8条回答
  • 2021-01-19 02:28

    As Stuck said.

    Simply remove the semicolon:

    wrong:    jdbc:h2:mem:testdb;
    correct:  jdbc:h2:mem:testdb
    
    0 讨论(0)
  • 2021-01-19 02:29

    In earlier version of spring, default url will be jdbc:h2:mem:testdb and testdb was created by default. from 2.3.0 onwards, if url is not mentioned it will auto generate database name. auto generated database name can be found in the spring logs.

    0 讨论(0)
  • 2021-01-19 02:29

    I just change spring.datasource.url in application property file to jdbc:h2:file:C:/data/test and run project.

    You Can See This video. https://youtu.be/yYWPuM8k8K4

    0 讨论(0)
  • 2021-01-19 02:31

    just append this to your application.properties file.

    spring.datasource.url=jdbc:h2:mem:testdb
    spring.data.jpa.repositories.bootstrap-mode=default
    
    0 讨论(0)
  • 2021-01-19 02:39

    I had a same problem and I changed the version of Spring Boot to 2.1.3 and it works

    0 讨论(0)
  • 2021-01-19 02:41

    I have the same problem with windows. I just change spring.datasource.url in application property file to jdbc:h2:file:C:/data/sample and run project. after that set JDBC URL to jdbc:h2:file:C:/data/sample. look like picture JDBC URL

    0 讨论(0)
提交回复
热议问题