I am creating a H2 database in my unit tests. The database uses the following properties:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.h2.Driver"/>
<property name="url" value="jdbc:h2:file:target/db/testdb"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
I am using version 1.3.166 of the com.h2database.h2
jar file.
When I run my tests, I see the database created in target/db
directory, and a testdb.h2.db
file exists. My tests run and load data from the database. I can open the target/db/testdb.h2.db
file and see the SQL statements that I used to create the database.
However, when I try to load the target/db/testsb.h2.db
file into a database browsing tool such as DBVisualizer, I cannot see any tables or data. For DBVisualizer I specify the H2(Embedded) mode.
I also tried the H2 console but a show tables
command returns an empty result set.
I can't see what I am doing wrong: the database file exists, the tests run against it correctly, but I cannot open this file in a database browser.
Any suggestions?