Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 318
Glide Avatar asked Nov 09 '22 18:11

Glide


1 Answers

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>
like image 153
blurfus Avatar answered Nov 14 '22 21:11

blurfus