title: Derby: Another instance of Derby may have already booted the database
body: <p>I would like to use Derby in a Network Server Mode and followed the instructions on their website. </p>
  
  <p>Starting derby:</p>
  
  <pre><code>/opt/glassfish/4.0/javadb/bin/NetworkServerControl start -noSecurityManager
  
  Sun Apr 13 23:47:57 CEST 2014 : Apache Derby Network Server - 10.9.1.0 - (1344872) started and ready to accept connections on port 1527
  </code></pre>
  
  <p>Connecting with <code>ij</code>:</p>
  
  <pre><code>$ /opt/glassfish/4.0/javadb/bin/ij
  ij version 10.9
  ij&gt; connect 'jdbc:derby:testDB';
  ij&gt; create table testt ( x varchar(200), y varchar(200), z varchar(13));
  0 rows inserted/updated/deleted
  ij&gt; select * from testt;
  
  X   
  
  |Y        
  
  
  
  |Z         
  -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
  
  0 rows selected
  ij&gt; commit;
  ij&gt; 
  </code></pre>
  
  <p>Connecting to Derby in Java:</p>
  
  <pre><code>static{
  
          try {
              Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
          } catch (Throwable e) {
              e.printStackTrace();
          }
      }
  
  public void readData(){
     final Connection connection = DriverManager.getConnection("jdbc:derby://localhost:1527/testDB");
     ....
  }
  </code></pre>
  
  <p>The <code>DriverManager.getConnection()</code> is failing with:</p>
  
  <pre><code>java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, 
  SQLERRMC: Failed to start database 'testDB' with class loader sun.misc.Launcher$AppClassLoader@23137792, see the next exception for details.::
  SQLSTATE: XSDB6Another instance of Derby may have already booted the database
  </code></pre>
  
  <p>Haven't I just started derby in network server mode? Why am I getting this error? </p>