title: HSQL Connection Error. Any insight?
body: <p>I'm trying to connect to HSQL using java.  I'm using a tutorial to work with JDBC and hibernate.  It's the lynda tutorials.  Anyway, here's the code below:  </p>
  
  <pre><code>package com.lynda.javatraining.db;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  
  public class Main {
  
      private static final String USERNAME = "dbuser";
      private static final String PASSWORD = "dbpassword";
      private static final String CONN_STRING =
              "jdbc:hsqldb://data/explorecalifornia";
  
      public static void main(String[] args) throws SQLException {
  
          //Class.forName("com.mysql.jdbc.Driver");
  
          Connection conn = null;
          System.out.println("A");
          System.out.println(conn == null);
          System.out.println(CONN_STRING);
          try {
              System.out.println("B1");
              conn = DriverManager.getConnection(CONN_STRING, USERNAME, PASSWORD);
              System.out.println("B1-2");
              System.out.println("Connected!");
          } catch (SQLException e) {
              System.out.println("B2");
              System.err.println(e);
          } finally {
              System.out.println("B3");
              if (conn != null) {
                  conn.close();
              }
          }
          System.out.println("C");
  
      }
  
  }
  </code></pre>
  
  <p>Here's the error I'm getting:  </p>
  
  <pre><code>A
  true
  jdbc:hsqldb://data/explorecalifornia
  B1
  2014-06-27T15:26:27.430-0400  SEVERE  could not reopen database
  org.hsqldb.HsqlException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@76d682a[file =/data/explorecalifornia.lck, exists=false, locked=false, valid=false, ] method: openRAF reason: java.io.FileNotFoundException: /data/explorecalifornia.lck (No such file or directory)
      at org.hsqldb.error.Error.error(Unknown Source)
      at org.hsqldb.error.Error.error(Unknown Source)
      at org.hsqldb.persist.LockFile.newLockFileLock(Unknown Source)
      at org.hsqldb.persist.Logger.acquireLock(Unknown Source)
      at org.hsqldb.persist.Logger.openPersistence(Unknown Source)
      at org.hsqldb.Database.reopen(Unknown Source)
      at org.hsqldb.Database.open(Unknown Source)
      at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
      at org.hsqldb.DatabaseManager.newSession(Unknown Source)
      at org.hsqldb.jdbc.JDBCConnection.&lt;init&gt;(Unknown Source)
      at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
      at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
      at java.sql.DriverManager.getConnection(DriverManager.java:571)
      at java.sql.DriverManager.getConnection(DriverManager.java:215)
      at com.lynda.javatraining.db.Main.main(Main.java:24)
  
  B2
  java.sql.SQLException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@76d682a[file =/data/explorecalifornia.lck, exists=false, locked=false, valid=false, ] method: openRAF reason: java.io.FileNotFoundException: /data/explorecalifornia.lck (No such file or directory)
  B3
  C
  </code></pre>
  
  <p>Can anyone tell e what I"m doing wrong?  Thanks.  </p>