Accessing play project database with h2-browser

后端 未结 2 1854
滥情空心
滥情空心 2020-12-08 14:47

I am having some trouble accessing the mem database via the h2-browser on a Play framework project.

With the configuration below, that I th

2条回答
  •  执笔经年
    2020-12-08 15:30

    To browse the contents of your database via the H2 Web Console, start both the web console and the Play application via the same Play console:

    1. At first, enter the Play console by running the Typesafe Activator:
      ~/Projects/play-app $ activator
    2. Start the web console:
      [play-app] $ h2-browser
      This should open the H2 console interface in your browser.
    3. Run the Play app:
      [play-app] $ run
    4. Access the Play app in your browser. This will cause the Play application to connect to the in-memory H2 database and to initialize it with some default data, if any.
    5. Log in to the H2 web console in your browser to inspect the database content. Use the following settings which you can save (for instance, as Play-App In-Memory Database) to easily access them again later:
      • Driver Class: org.h2.Driver
      • JDBC URL: jdbc:h2:mem:play
      • User Name: sa
      • Password:

    Note that the above settings have to match your actual configuration (db.default.url and so on).

提交回复
热议问题