title: org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process"
body: <p>I am trying to follow the direction to setup the Virgo sample project greenpages ( <a href="http://www.eclipse.org/virgo/documentation/greenpages-documentation-2.4.0.RELEASE/docs/html/ch02s03.html" rel="nofollow">http://www.eclipse.org/virgo/documentation/greenpages-documentation-2.4.0.RELEASE/docs/html/ch02s03.html</a> ).  When i execute the data script I get an exception.</p>
  
  <p>The database is started like so:</p>
  
  <pre><code>start java -cp ";C:\Users\flowersj\.m2\repository\com\h2database\h2\1.3.161\h2-1.3.161.jar" 
      org.h2.tools.Server
  </code></pre>
  
  <p>The script to insert data that fails on this line:</p>
  
  <pre><code>java -cp ";C:\Users\flowersj\.m2\repository\com\h2database\h2\1.3.161\h2-1.3.161.jar"
      org.h2.tools.RunScript 
      -url jdbc:h2:tcp://localhost/~/greenpages-db/greenpages 
      -user greenpages -password pass -script db.sql
  </code></pre>
  
  <p>The exception is:</p>
  
  <pre><code>Exception in thread "main" org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-161]
      at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
      at org.h2.message.DbException.get(DbException.java:169)
      at org.h2.message.DbException.get(DbException.java:146)
      at org.h2.store.FileLock.getExceptionAlreadyInUse(FileLock.java:435)
      at org.h2.store.FileLock.lockFile(FileLock.java:332)
      at org.h2.store.FileLock.lock(FileLock.java:128)
      at org.h2.engine.Database.open(Database.java:539)
      at org.h2.engine.Database.openDatabase(Database.java:219)
      at org.h2.engine.Database.&lt;init&gt;(Database.java:214)
      at org.h2.engine.Engine.openSession(Engine.java:56)
      at org.h2.engine.Engine.openSession(Engine.java:159)
      at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
      at org.h2.engine.Engine.createSession(Engine.java:121)
      at org.h2.server.TcpServerThread.run(TcpServerThread.java:124)
      at java.lang.Thread.run(Unknown Source)
  
      at org.h2.engine.SessionRemote.done(SessionRemote.java:538)
      at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:109)
      at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:373)
      at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:267)
      at org.h2.jdbc.JdbcConnection.&lt;init&gt;(JdbcConnection.java:110)
      at org.h2.jdbc.JdbcConnection.&lt;init&gt;(JdbcConnection.java:94)
      at org.h2.Driver.connect(Driver.java:72)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at org.h2.tools.RunScript.process(RunScript.java:312)
      at org.h2.tools.RunScript.runTool(RunScript.java:140)
      at org.h2.tools.RunScript.main(RunScript.java:68)
  </code></pre>