0

I created DAO data tier with JDBC and HSQLDB in standalone mode. I'm creating connection in this way:

Connection c = DriverManager.getConnection("jdbc:hsqldb:file:/databases/testdb", "sa", "");

Project is build with maven to jar and is used in two different projects. In first project I am inserting some records to db (all unit tests passed). But when I invoke second project where SELECT queries are executed, database is empty.

In other words: It looks like database is dropped after executing first project (I checked this with DatabaseManagerSwing, tables are empty). When I run SELECT query in first project after inserting - records are available. What can be reason of this situation?

Thanks for every advice.

It'sMe
  • 125
  • 1
  • 15
  • 1
    Is your code issuing a `SHUTDOWN` command or otherwise making sure to [close the database](http://hsqldb.org/doc/2.0/guide/running-chapt.html#rgc_closing_db) before exiting? – Gord Thompson Feb 02 '15 at 17:20
  • A big rollback maybe; You could open the db file with some tool to figure out –  Feb 02 '15 at 17:20
  • @GordThompson, I tried to add `;shutdown=true` to connection string. It didn't work – It'sMe Feb 02 '15 at 17:33
  • @RC. has a good point - Have you used `getAutoCommit()` to check the Auto-Commit status of the connection and ensured that your changes are actually being committed before your application terminates? – Gord Thompson Feb 02 '15 at 18:15
  • Check the database files exist and use the DatabaseManager to open the database. – fredt Feb 03 '15 at 03:26

0 Answers0