Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

DB Connection close issue in Node.js using trireme-jdbc

Not applicable

I have developed and deployed a Node.js application in apigee, which performs few CRUD operations. To establish db connection I have used trireme-jdbc module of node.js. I am able to perform all CRUD operations well through trireme-jdbc but I have problem with DB session close using db.close() function in trireme-jdbc. When I use db.close() it do not close currently active/open session from the pool. I want to know is there any other process or way to close db connection perfectly. Also I want to close all active connections from pool.

Any help will be appreciated. Below is the sample code to establish connection, run a select query and used db.close() to close session. My database is Openedge/Progress.

var jdbc = require('trireme-jdbc');
var db = new jdbc.Database({
      url : connectionURL, 
      properties: {
        user: 'XXXXXX',
        password: 'XXXXXX',
      },
      minConnections:1,
      maxConnections:2,
      idleTimeout:10
    });
db.execute('select * from users ', function(err, result, rows) {
  console.log(err);
  console.log(result);
  rows.forEach(function(row) {
    console.log(row);
  });
  db.close();   // Used to close DB session/connection.
});

0 2 1,410
2 REPLIES 2