Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error while connection to Ibm_db2 from a Node js platform

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 ?
like image 814
KRUSHANU MOHAPATRA Avatar asked May 09 '26 22:05

KRUSHANU MOHAPATRA


1 Answers

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.

like image 157
sos418 Avatar answered May 12 '26 14:05

sos418



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!