Open H2 UI When Debugging in Eclipse

This time it is about debugging the H2 embedded database, which is very similar to procedure used with the HSQLDB I posted earlier.

Assuming that the hibernate.connection.url is set to jdbc:h2:mem:myDb, you can following similar steps as in my previous post:

  • Let Eclipse pause at a breakpoint;
  • Open the Display view and enter org.h2.tools.Server.createWebServer(“-webPort”, “10500”).start().
  • Select the entered text, right click and choose Execute

This will launch a web server at port 10500. If you don’t specify a port number, the default 8082 will be used.

Now you can open “localhost:10500” to log into the database. Note that you may need to modify the default JDBC URL and User name on the UI to be connected to the same database. For example, I needed to change the DB URL to match my Hibernate settings. Also since I didn’t specify hibernate.connection.username for my unit test configuration, I needed to change the user name to the empty string by removing the default “sa”.

H2

Advertisements
This entry was posted in Database, Java, Tool and Debug and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s