Spring Boot + IntelliJ + Embedded Database = Headache

前端 未结 5 1799
执笔经年
执笔经年 2020-12-29 05:05

Either I\'m missing some core concept buried deep within some documentation (Spring, Spring Boot, H2, HSQLDB, Derby, IntelliJ) or I\'ve been staring at this for too long.

5条回答
  •  清歌不尽
    2020-12-29 05:49

    Using the example here to expose an in-memory DB via console and TCP I was able to connect using H2 Console and IntelliJ client as per screenshots.

    https://stackoverflow.com/a/52949164/2930427

    Connect using IntelliJ - jdbc:h2:tcp://localhost:9092/mem:default

    Connect using H2 Console: jdbc:h2:mem:default

    Example application.yml

    spring:
      application:
        name: example-service
      r2dbc:
        url: r2dbc:pool:h2:mem:///default?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
        username: testuser
        password: testpass
        pool:
          initial-size: 100
          max-size: 500
          max-idle-time: 30m
          validation-query: SELECT 1
    

提交回复
热议问题