This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HSQLDB & Ant - tables not persisting?

Posts: 9099
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wasn't sure which forum to ask this question in, but this forum seemed to have more references to HSQLDB, so here I am.

I have set included the hsqldb.jar in my lib and I have the following properties:

When I run the ant sql target, it seems to create the database files in the same directory as the build script.
So far, so good. When I run the target, which includes the following sql statements

it fails to execute the DROP TABLE statements. This is expected as the tables do not yet exist.

However, when I run the same target again, I get the same error.

According to the docs, "Memory tables are the default type when the CREATE TABLE command is used. Their data is held entirely in memory but any change to their structure or contents is written to the <dbname>.script file. The script file is read the next time the database is opened, and the MEMORY tables are recreated with all their contents. So ... MEMORY tables are persistent."

I don't understand why the tables don't exist after I've already created them.
Marilyn de Queiroz
Posts: 9099
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use COMMIT and SHUTDOWN, the problem is resolved. Ant sets autocommit to false by default. And apparently the memory tables are not persisted until shutdown is executed.
    Bookmark Topic Watch Topic
  • New Topic