title: Unable to reconnect to Derby from Tomcat server started via Eclipse
body: <p>I'm running on Win 7 using Eclipse 4.2 starting a web app on a Tomcat 7 server and using Derby database. I have tried many approaches but run consistently into a common problem:</p>
  
  <ul>
  <li>Everything works just fine the first time I start up and run.</li>
  <li>When I redeploy my application after a change, all database connections hang (any kind of restart).</li>
  <li>If I stop Eclipse and restart Eclipse, that clears up the problem and the next run works fine again.</li>
  </ul>
  
  <p>Having done some investigation, it appears that the problem is that the Derby port (1527) is not released from one execution of the server to the next. That seems very strange to me since Derby is started by the Tomcat instance which is a separate javaw process.</p>
  
  <p>I've tried:</p>
  
  <ul>
  <li>Configuring the Derby connection as a Tomcat resource</li>
  <li>Establishing the connection within my code (rather than via Tomcat resource)</li>
  <li>Both the embedded and the network driver</li>
  <li>Starting / stopping the network driver from a servlet on startup and shutdown of the Tomcat server</li>
  <li>Shutting down the embedded driver via servlet on shutdown of Tomcat</li>
  </ul>
  
  <p>Again, every approach works fine to connect the first time.</p>
  
  <p>One other symptom that doesn't appear to be related (except for as a possible indicator of whether or not shutdown completes correctly) is that the db.lck file for my database never gets deleted. However, whether or not it exists has no bearing on whether or not I can reconnect (only stopping/starting eclipse has an impact).</p>
  
  <p>Any insight would be appreciated.
  Thanks!</p>