Glide
Glide

Reputation: 21245

How to view H2 in-memory database while integration tests are running?

How do I view the H2 in-memory database while integration tests are running? The H2WebServer is started at the beginning of my integration tests. But the H2WebServer doesn't respond to my browser request when I have set a breakpoint in the code which makes it impossible to actually view the database..

Upvotes: 6

Views: 1762

Answers (1)

blurfus
blurfus

Reputation: 14031

If you add this to your spring config file for the test context, you should be able to connect to the database with a regular SQL client such as Squirrel.

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName">
            <value>org.hsqldb.jdbcDriver</value>
        </property>
        <property name="url">
            <value>
               jdbc:hsqldb:hsql://localhost/xdb;check_props=true;default_schema=true;
           </value>
        </property>
        <property name="username">
            <value>sa</value>
        </property>
        <property name="password">
            <value></value>
        </property>
    </bean>

Upvotes: 1

Related Questions