2

I am trying to connect to a DB2 server but I am getting bellow given error.

I'm following the given documentation: npm db2 Doc

I have done npm i ibm_db2

Code:

const ibmdb = require('ibm_db');

const connectQuery =
'DATABASE=' +
DATABASE +
';HOSTNAME=' +
HOSTNAME +
';UID=' +
UID +
';PWD=' +
PWD +
';PORT=' +
PORT +
';PROTOCOL=TCPIP';

ibmdb.open(connectQuery, function(err, conn) {
    if (err) return console.log(err);

    conn.query('select 1 from sysibm.sysdummy1', function(err, data) {
        if (err) console.log('err');
        else console.log('data');

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

Error:

Error: Could not locate the bindings file. Tried:
 → ...\node_modules\ibm_db\build\odbc_bindings.node
 → ...\node_modules\ibm_db\build\Debug\odbc_bindings.node
 → ...\node_modules\ibm_db\build\Release\odbc_bindings.node
 → ...\node_modules\ibm_db\out\Debug\odbc_bindings.node
 → ...\node_modules\ibm_db\Debug\odbc_bindings.node
  • Is there any other node package to establish connection ?
KRUSHANU MOHAPATRA
  • 552
  • 1
  • 6
  • 18

2 Answers2

1

I have the same issue on windows 10. Because your ibm_db module is not installed successfully.

Download directly clidriver generated by IBM. After setting IBM_DB_HOME environment variable to point the directory, and reinstall ibm_db module to skip downloading clidriver.

sos418
  • 782
  • 8
  • 13
0

Because your ibm_db module is not installed successfully due to proxy on Windows 10.

You can just disconnect VPN and install ibm_db node package it should work.

Gaurab Kumar
  • 2,144
  • 2
  • 17
  • 29