Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access in-memory h2 database from Intellij IDEA

In Spring Boot project I am trying to see in-memory tables from my IDE.

How to access in-memory h2 database from Intellij IDEA.

Here is a snippet from my application.yml:

 h2:
    datasource:
        url: jdbc:h2:mem:mydb
        username: username
        password: 123
        driver-class-name: org.h2.Driver
        init-sql: h2.sql
    console:
      enabled: true
      path: /search/console
      settings:
        trace: false
        web-allow-others: false

Intellij has no field to input username for in-memory database: Intellij has no field to input username for in-memory database Test Connection shows success, however it doesn't see tables from h2.sql. I can access them using h2 console.

like image 956
valijon Avatar asked Sep 18 '18 14:09

valijon


1 Answers

By the default, IntellJ doesn't show any of database.

enter image description here

  1. right click at the datasource then choose Properties

enter image description here

  1. At the Schemas tab, you'll see a list of options to choose which database should be shown (I normally choose All databases). Choose the database which you need it to be shown

enter image description here

The result:

enter image description here

like image 81
Phong Bui Avatar answered Sep 17 '22 10:09

Phong Bui