Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.JS and DB2 Connection

Tags:

node.js

db2

I am attempting to begin writing a Node.JS Application that relies on some data stored in a DB2 database. I've come across two node modules that would work for me. DB2.js and ibm_db, both on the NPMjs site.

After following the install guides for both

https://github.com/herzi/db2.js

and

https://www.ibm.com/developerworks/community/blogs/pd/entry/using_ibm_db2_from_node_js4?lang=en

After following IBM's install guide for their module, I realized that I need to get the Linux drivers for DB2 installed. However, their instructions aren't very clear and have me install a new copy of node into my home folder. I have nodejs already installed globally and when I substitute it's install folder at /usr/lib/nodejs I still get compile errors when trying to do node-gyp configure build in either my clone of db2.js or ibm_db

The specific error I'm getting is related to some files that are supposed to get installed with the Linux DB2 drivers, namely sqlcli.h and sqlcli1.h. Here is the error message I get when running node-gyp configure build for either project.

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/mint/Programming/node-ibm_db/build'
  CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
In file included from ../src/odbc.cpp:25:0:
../src/odbc.h:29:21: fatal error: sqlcli1.h: No such file or directory
 #include <sqlcli1.h>
                     ^
compilation terminated.
make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
make: Leaving directory `/home/mint/Programming/node-ibm_db/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-12-generic
gyp ERR! command "node" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /home/mint/Programming/node-ibm_db
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 
like image 331
EthanLWillis Avatar asked Oct 19 '25 08:10

EthanLWillis


1 Answers

I think you need to install the IBM Data Server Client package for your version of the DB2 server -- it contains, in addition to the libraries, the header files required for compilation.

like image 151
mustaccio Avatar answered Oct 21 '25 01:10

mustaccio