Unable to connect remote db2 with node js

929 views Asked by At

I am trying to connect remote ibm db2 with node js in mac machine but I'm getting following error

[Error: [IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968
] {
  error: '[node-ibm_db] SQL_ERROR',
  sqlcode: -1598,
  message: '[IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968\n',
  state: '42968'
}

And this is how I'm trying to connect

function db2Connection() {
  var ibmdb = require('ibm_db');
var connStr = "DATABASE=dbname;HOSTNAME=mydb.ibm.com;UID=userid;PWD=password;PORT=447;PROTOCOL=TCPIP";

ibmdb.open(connStr, function (err,conn) {
  if (err) return console.log(err);
  
  conn.query('SELECT * FROM T_Name FETCH FIRST 6 ROWS ONLY', function (err, data) {
    if (err) console.log(err);
    else console.log(data);

    conn.close(function () {
      console.log('done');
    });
  });
});
}

db2Connection();

I went through some docs regarding that error but did not get any solution. Can anyone help on how to achieve this.

0

There are 0 answers