Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot in memory database not accessible from other tools

I am trying to access an in memory H2 database from the intellij console. I'm using spring boot to configure everything. The connection string is: spring.datasource.url=jdbc:h2:mem:testdb

When I connect to the database using intellij I can't see or query the tables. I can run a create table command to get it but that is it. Here is an image of that config:

enter image description here

The result of a SHOW TABLES query returns nothing.

Why can't I connect to this database?

like image 742
Tim Schimandle Avatar asked Oct 24 '25 04:10

Tim Schimandle


1 Answers

When using an in-memory database like H2 or HSQLDB that in-memory instance is only accessible from the application.

If you want to have a shared database (so that you can see what is inside it) you have to start it in [server mode][2] or use a file based mode instead (jdbc:h2:~/your-db).

like image 110
M. Deinum Avatar answered Oct 26 '25 17:10

M. Deinum