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”.