View content of H2 or HSQLDB in-memory database

后端 未结 11 1363
失恋的感觉
失恋的感觉 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 06:00

    For HSQLDB, The following worked for me:

    DatabaseManager.threadedDBM();
    

    And this brought up the GUI with my tables and data once I pointed it to the right named in-mem database.

    It is basically the equivalent of newing up a DatabaseManager (the non Swing variety), which prompts for connection details, and is set to --noexit)

    I also tried the Swing version, but it only had a main, and I was unsure of the arguments to pass. If anyone knows, please post here.

    Just because I searched for hours for the right database name: The name of the database is the name of your datasource. So try with URL jdbc:hsqldb:mem:dataSource if you have a data source bean with id=dataSource. If this does not work, try testdb which is the default.

提交回复
热议问题