ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
188 stars 151 forks source link

Error Odbc_binding.node while trying to start node app.js #941

Closed Abinaya-26 closed 10 months ago

Abinaya-26 commented 10 months ago

I am trying to do a project in node.js with IBM DB2 as database. I have given npm i ibm_db, and also npm i odbc, and have done all connection codes.. If i give npm start, I am getting below error. I have also tried uninstalling node modules, node , npm and reinstall, rebuild and also changing ibm db2 version...while giving npm i ibm_db, I didn't get any errors so I don't know how to resolve. Pls help in this regard..I don't know why this odbc binding is still not resolved and I am using windows 64 bit. I am also using node js for 64 bit for windows. I found that inside node_modules/ibm_db/ the build/Release/odbc_bindings.node file is missing how to configure it manually. I don't know whether due to this i am getting this error. But I have tried installing more than 10 times with many other version also since i was getting same error. I have also tried installing with all permission then also same error. I have also tried with ibm_db 3.2.1 new version same error.

1) process.arch -> x64 2) Node Version ->v18.17.1 3) npm -v -> 9.6.7

System config

1) x64-based PC

Error: Could not locate the bindings file. Tried: → /home/src/app/node_modules/ibm_db/build/odbc_bindings.node → /home/src/app/node_modules/ibm_db/build/Debug/odbc_bindings.node → /home/src/app/node_modules/ibm_db/build/Release/odbc_bindings.node → /home/src/app/node_modules/ibm_db/out/Debug/odbc_bindings.node → /home/src/app/node_modules/ibm_db/Debug/odbc_bindings.node → /home/src/app/node_modules/ibm_db/out/Release/odbc_bindings.node → /home/src/app/node_modules/ibm_db/Release/odbc_bindings.node → /home/src/app/node_modules/ibm_db/build/default/odbc_bindings.node → /home/src/app/node_modules/ibm_db/compiled/18.17.1/win32\x64/odbc_bindings.node -> /home/src/app/node_modules/ibm_db/addon-build/release/install-root/odbc_binding.node ->/home/src/app/node_modules/ibm_db/debug/install-root/odbc_bindings.node ->/home/src/app/node_modules/ibm_db/addon-build/debug/install-root/odbc_bindings.node ->/home/src/app/node_modules/ibm_db/lib/binding/node-v108-win32-x64/odbc_bindings.node`

at bindings (/home/src/app/node_modules/bindings/bindings.js:93:9) at Object. (/home/src/app/node_modules/ibm_db/lib/odbc.js:31:31) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extension..js(node:internal/modules/cjs/loader:1310:10) at Module.load(node:internal/modules/cjs/loader:1119:32) at Module._load(node:internal/modules/cjs/loader:960:12) atModule.require(node:internal/modules/cjs/loader:1143:19) at require(node:internal/modules/cjs/helpers:121:18) at Module._compile(node:internal/modules/cjs/loader:1256:14)

bimalkjha commented 10 months ago

@Abinaya-26 Please run below commands from terminal and share complete output of below commands:

cd /home/src/app/node_modules/ibm_db/
npm install
vi test/config.testConnectionStrings.json  => Update database connection info in this file and save it.
node test/test-basic-test.js

Also, if you are using Windows system, then path should start from driver letter like C:\Users but I see non windows style path in the shared error message. Any info about that? Thanks and Regards, Bimal Jha

Abinaya-26 commented 10 months ago

Sorry for that mistake. I have navigated inside node_modules\ibm_db and given npm install and getting the below error. Since this issue is not resolved so I haven't given the connection details in test file. Pls help me in this regard to resolve the issue.

i) C:\Users\Abi\VsCodeWrkspace\DemoProj\node_modules\ibm_db> npm i

ibm_db@2.8.2 install node installer/driverInstall.js

platform = win32 , arch = x64, node.js version = v18.17.1


You are downloading a package which includes the Node.js module for IBM DB2/Informix. The module is licensed under the Apache License 2.0. The package also includes IBM ODBC and CLI Driver from IBM, which is automatically downloaded as the node module is installed on your system/device. The license agreement to the IBM ODBC and CLI Driver is available in C:\Users\Abi\VsCodeWrkspace\DemoProj\node_modules\ibm_db\installer\clidriver. Check for additional dependencies, which may come with their own license agreement(s). Your use of the components of the package and dependencies constitutes your acceptance of their respective license agreements. If you do not accept the terms of any license agreement(s), then delete the relevant component(s) from your device.


Downloading DB2 ODBC CLI Driver from https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ntx64_odbc_cli.zip ...

Error 400: Bad Request – https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ntx64_odbc_cli.zip Downloading DB2 ODBC CLI Driver from https://github.com/ibmdb/db2drivers/raw/main/clidriver/ntx64_odbc_cli.zip ...

Error 400: Bad Request - https://github.com/ibmdb/db2drivers/raw/main/clidriver/ntx64_odbc_cli.zip

===================== Error: Installation of ibm_db failed.

added 62 packages, and audited 63 packages in 21s

4 packages are looking for funding run npm fund for details

found 0 vulnerabilities

bimalkjha commented 10 months ago

@Abinaya-26 It seems your system has some network issue mostly DNS issue. npm i is unable to download file https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ntx64_odbc_cli.zip or https://github.com/ibmdb/db2drivers/raw/main/clidriver/ntx64_odbc_cli.zip. Please click on these links and see if you are able to download it manually. If you have downloaded ntx64_odbc_cli.zip file from either of link, unzip it, you'll get clidriver directory. Move it under C:\Users\Abi\VsCodeWrkspace\DemoProj directory. Then run below commands from terminal:

set IBM_DB_HOME=C:\Users\Abi\VsCodeWrkspace\DemoProj\clidriver
cd node_modules\ibm_db
npm i

You can search about Error 400: Bad Request on internet and try to resolve it. It should be some DNS or firewall related issue. Thanks.

Abinaya-26 commented 10 months ago

Thank you so much @bimalkjha. I will proceed with the steps you have given.