1

I'm using Embedded database for running my test cases while maven test phase. I assume Spring must be starting the HSQLDB server. Is my assumption correct ?

<jdbc:embedded-database id="dataSource" type="HSQL"> 
    <jdbc:script location="classpath:schema.sql"/> 
    <jdbc:script location="classpath:data.sql"/> 
</jdbc:embedded-database>

How can i view the schema/table created in hsqldb using above mentioned script ? I tried connecting through DBVisulaizer but i don't see tables there.

Pankaj
  • 3,512
  • 16
  • 49
  • 83
  • This post might help: http://stackoverflow.com/questions/591518/how-to-see-all-the-tables-in-an-hsqldb-database – Shawn Vader Jun 22 '13 at 18:54

1 Answers1

1

The jdbc:embedded-database URL connects to an in-process memory database, not a server.

You need to start a server separately (a separate process) which fronts an in-memory database. You can find information on how to do this in the HSQLDB Guide.

http://www.hsqldb.org/doc/2.0/guide/listeners-chapt.html

You than use a normal connection URL such as jdbc:hsqldb:hsql://localhost/test in Spring to connect to the server. You can also connect to the server with DbVisualiser using the same URL.

fredt
  • 24,044
  • 3
  • 40
  • 61
  • Thanks. This helps. Even i noticed that hsqld db has a client at .\hsqldb\bin\runManagerSwing.bat. This also helps to connect to db. – Pankaj Jun 24 '13 at 18:35
  • hsqldb can also be filed based, use jdbc:hsqldb:file:[path to db] as your connection string – jorrebor Dec 10 '13 at 06:53
  • Note that to run HSQLDB in server mode (which allows connections from external clients), you don't need to start it in a separate process. You can embed it in your application by instantiating an `org.hsqldb.server.Server` object. – pacoverflow Oct 21 '16 at 17:46