Why are added tables from Java not visible when I open the H2 console?

后端 未结 2 799
故里飘歌
故里飘歌 2021-01-19 18:43

I use an H2 embedded database in Java, and after creating the database and adding some tables and data, it gets saved as a file in a directorey of my computer.

But wh

2条回答
  •  时光取名叫无心
    2021-01-19 19:36

    The accepted ans is correct- it's URL issue. But for recent user, I am posting the updated values (I am using SpringBoot 2 with Spring Data JPA). When you open H2 Console, the default URL shown for DB Connection is: jdbc:h2:~/test . If you connect using this URL, you won't find the tables you created in your app. But user generated tables to be seen use URL as jdbc:h2:mem:testdb. Pls, refer below figures:

    Here EXCHANGE_VALUE was my JPA generated table, that i could see after connecting to db using URL as jdbc:h2:mem:testdb.

提交回复
热议问题