title: HSQLDB file mode is not working
body: <p>I am using HSQLDB with Hibernate 5  and Spring 4.</p>
  
  <p>I have some beans definitions in my spring-context.xml:</p>
  
  <pre><code>&lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/&gt;
  
      &lt;jdbc:embedded-database id="dataSource" type="HSQL"&gt;
          &lt;jdbc:script location="classpath*:database/database_schema.sql"/&gt;
      &lt;/jdbc:embedded-database&gt;
  
      &lt;beans:bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"&gt;
          &lt;beans:property name="dataSource" ref="dataSource"/&gt;
          &lt;beans:property name="configLocation" value="hibernate/hibernate.cfg.xml"/&gt;
          &lt;beans:property name="annotatedClasses"&gt;
              &lt;beans:list&gt;
                 ...lot of project beans path values..
              &lt;/beans:list&gt;
          &lt;/beans:property&gt;
      &lt;/beans:bean&gt;
  
      &lt;beans:bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"&gt;
          &lt;beans:property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/beans:bean&gt;
  </code></pre>
  
  <p>And Hibernate.cfg.xml contains:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD//EN"
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.enable_lazy_load_no_trans"&gt;true&lt;/property&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.HSQLDialect&lt;/property&gt;
          &lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt;
          &lt;property name="hibernate.show_sql"&gt;true&lt;/property&gt;
          &lt;property name="connection.driver_class"&gt;org.hsqldb.jdbcDriver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:hsqldb:file:D/database&lt;/property&gt;
          &lt;property name="connection.pool_size"&gt;10&lt;/property&gt;
          &lt;property name="connection.username"&gt;SA&lt;/property&gt;
          &lt;property name="connection.password"&gt;&lt;/property&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>All dao and services layers is working fine. Data is always saved and all is all right. </p>
  
  <p>But in the next launch all data is deleting from database. </p>
  
  <p>I am trying to save my database data in file and to use this data again, and I have tried many variants. The last of them is from question <a href="https://stackoverflow.com/questions/24822413/embedded-hsqldb-persist-data-to-a-file?rq=1">about HSQLDB url config</a></p>
  
  <p>I have added the line to my hibernate.cfg.xml file:</p>
  
  <pre><code> &lt;property name="connection.url"&gt;jdbc:hsqldb:file:D/database&lt;/property&gt;
  </code></pre>
  
  <p>It doesn't helped to me. There is no file creating in this path.</p>
  
  <p>Also i am trying to use the advice from <a href="https://stackoverflow.com/questions/6734158/has-hsqldb-some-mechanism-to-saving-in-memory-data-to-file">question</a> and to use SCRIPT SQL command, but I do not fully understand how to properly use it and where i must to place it directly?</p>
  
  <p><strong>Question</strong>: How should I configure HSQLDB to save all data from my database to a file after closing app and to re-use this data after opening this application again?
  Can you write some small and valid example with the correct configuration of HSQLDB for this question?</p>
  
  <p><strong>Edit #1:</strong>
  Thank's jchampemont, i tried your variant and all your steps, but still nothing. The file is still doesn't exists :( 
  Hibernate file is picked, all hibernate config is working fine.</p>
  
  <p><strong>Issue is fixed! Thank's to jchampemont and to fredt</strong></p>
  
  <p>I have forgot to delete this values in hibernate.cfg.xml...:</p>
  
  <pre><code>        &lt;property name="connection.driver_class"&gt;org.hsqldb.jdbcDriver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:hsqldb:file:D:/database.lck&lt;/property&gt;
          &lt;property name="connection.pool_size"&gt;10&lt;/property&gt;
          &lt;property name="connection.username"&gt;SA&lt;/property&gt;
          &lt;property name="connection.password"&gt;&lt;/property&gt;
  </code></pre>
  
  <p>And i have created the bean dataSource like in <a href="https://stackoverflow.com/a/36444770/5331196">jchampemont answer</a> 
  After deleting this 4 lines - everything start's to work fine, base were created in D:\database folder and everything is cool. Thank's for answers! Peace :)</p>