View content of H2 or HSQLDB in-memory database

后端 未结 11 1355
失恋的感觉
失恋的感觉 2020-12-02 05:27

Is there a way to browse the content of an H2 or an HSQLDB in-memory database for viewing? For example, during a debugging session with Hibernate in order to check when the

11条回答
  •  死守一世寂寞
    2020-12-02 05:54

    This is more a comment to previous Thomas Mueller's post rather than an answer, but haven't got enough reputation for it. Another way of getting the connection if you are Spring JDBC Template is using the following:

    jdbcTemplate.getDataSource().getConnection();
    

    So on debug mode if you add to the "Expressions" view in Eclipse it will open the browser showing you the H2 Console:

    org.h2.tools.Server.startWebServer(jdbcTemplate.getDataSource().getConnection());
    

    Eclipse Expressions View

    H2 Console

提交回复
热议问题