title: How to release Oracle Database connection when Node.js exits
body: <p>I am using oracle database for my nodejs application.</p>
  
  <p>When altering any table, i am getting error <strong>resource already in used</strong>.</p>
  
  <p>This error getting because when terminating or when exiting the nodejs application the database connection is not getting released or closed.</p>
  
  <p>I know how to release database connection</p>
  
  <pre><code>function doRelease() {
      db.close(
          function (err) {
              if (err)
                  console.error(err.message);
          });
  }
  </code></pre>
  
  <p>But i dont know, how to call the above function on nodejs exit or node terminate??</p>
  
  <p>So i want simple help </p>
  
  <p>how to release db connection when exiting or terminating nodejs application </p>
  
  <p>Any help will be appreciated</p>