title: How to run H2 database in server mode?
body: <p>I need to start H2 database in server mode from my application. Having tried the following code:</p>
  <pre><code>server = Server.createTcpServer().start();
  </code></pre>
  <p>Here is the properties for the connection:</p>
  <pre><code>javabase.jdbc.url = jdbc:h2:tcp://localhost:9092/nio:~/source/db/database/db;AUTO_SERVER=TRUE
  javabase.jdbc.driver = org.h2.Driver
  javabase.jdbc.username = sa
  javabase.jdbc.password =
  </code></pre>
  <p>When I run the program, I got the following error:</p>
  <pre><code>client.db.exception.DAOException: org.h2.jdbc.JdbcSQLException: Database may be already in use: &quot;Locked by another process&quot;. Possible solutions: close all other connection(s); use the server mode [90020-164]
      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:439)
      at org.h2.store.FileLock.lockFile(FileLock.java:336)
      at org.h2.store.FileLock.lock(FileLock.java:128)
      at org.h2.engine.Database.open(Database.java:542)
      at org.h2.engine.Database.openDatabase(Database.java:222)
      at org.h2.engine.Database.&lt;init&gt;(Database.java:217)
      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:133)
      at java.lang.Thread.run(Thread.java:680)
  </code></pre>