• Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

Comments (26)

1 Praveen Devarao commented Permalink

With the release of ibm_db node.js module one can connect to DB2 and Informix directly now. This removes the need to use unixODBC driver manager. I have updated the post to demonstrate usage of ibm_db module.

2 ivyho commented Permalink

Hi for the npm ibm_db2, you mentioned, there is a requirement
to install the Install IBM Data Server Driver.

so do we install this dataserver driver on the local client machine? or on the remote machine where our d2 is installed?
The driver supports aix and linux.
and if our db2 server is installed only on a aix box.
our clients machine OS are windows, mac, xlinux (,ppc64,ppc32--pLinux), and aix .
will all these configurations be supported?

3 Praveen Devarao commented Permalink

Hi Ivy,

The Data Server Driver will have to be installed on the local client machines.
The mentioned configurations are supported except Mac OS. If you need windows 64-bit binaries drop me your email- id I can share them. 32-bit windows binaries is still work in progress.

4 Spidy commented Permalink

Hi Praveen,

Just and update regarding Mac OS
I develop on Mac OS, and was able to install/build ibm_db. I haven't tested all functionality as yet but I'm able to connect and query data.

5 ivyho commented Permalink

That is great.Thanks

6 ivyho commented Permalink

From this link

The data server driver link does not work
Where can I get the db2 data server driver?
Is it the data server client code or the data server driver package that we need? Which one? there are many links on the page.
I tried both, both links do not work .

7 ivyho commented Permalink

I found one link , please confirm this is the correct package.

1.You should fix the others broken links on the
2. also there are many different packages
It is really confusing .

8 ivyho commented Permalink

With the wndows 64 binaries you sent us, we can connect to the db2 on aix via nodejs on a wndow client..
No need for any other db2 client drivers.
we only need the npm install bndings.
This is pretty cool!

9 ivyho commented Permalink

When I tried to do a npm install ibm_db on ppc64 machine. (power)
got some errors.

tic member of âclass ODBCâ
../src/odbc.cpp:275: error: âSQLHSTMTâ was not declared in this sco pe
../src/odbc.cpp:275: error: expected primary-expression before âsho rtâ
../src/odbc.cpp:275: error: initializer expression list treated as compound expression
../src/odbc.cpp:275: error: expected â,â or â;â before â{â token
make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
make: Leaving directory `/home/ivyho/testDB2/node_modules/ibm_db/bu ild'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/ivyho/IBMSVT32/lib /node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:107 :17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_pr ocess.js:1045:12)
gyp ERR! System Linux 2.6.32-279.el6.ppc64
gyp ERR! command "node" "/home/ivyho/IBMSVT32/lib/node_modules/npm/ node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/ivyho/testDB2/node_modules/ibm_db
gyp ERR! node -v v0.11.12
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! ibm_db@0.0.1 preinstall: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ibm_db@0.0.1 preinstall script.
npm ERR! This is most likely a problem with the ibm_db package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls ibm_db
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-279.el6.ppc64
npm ERR! command "/home/ivyho/IBMSVT32/bin/node" "/home/ivyho/IBMSV T32/bin/npm" "install" "ibm_db"
npm ERR! cwd /home/ivyho/testDB2
npm ERR! node -v v0.11.12
npm ERR! npm -v 1.4.3
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ivyho/testDB2/npm-debug.log
npm ERR! not ok code 0

10 ivyho commented Permalink

while we were making progress on one window environment,
we are unable to reproduce the success on another windows environment.

This is the error we got:
throw new Error('Could not load the bindings file. Tried:\n' +
Error: Could not load the bindings file. Tried:
- c:\testM\node_modules\ibm_db\out\Debug\odbc_bindings
- c:\testM\node_modules\ibm_db\Debug\odbc_bindings
- c:\testM\node_modules\ibm_db\out\Release\odbc_bindings
- c:\testM\node_modules\ibm_db\Release\odbc_bindings
- c:\testM\node_modules\ibm_db\compiled\win32\x64\0.1\odbc_bindings
at bindings (c:\testM\node_modules\bindings\bindings.js:69:9)
at Object.<anonymous> (c:\testM\node_modules\ibm_db\lib\odbc.js:18:31)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (c:\testM\db2testing.js:1:75)
at Module._compile (module.js:456:26)
We copy the win64 binary into the node_modules
we did npm install bindings
Any help is appreciated.</anonymous></anonymous>

11 Praveen Devarao commented Permalink

Hi Ivy,

On windows platform. Are you sure the other platform is also 32-bit and the IBM Data Server Driver [DB2 client] is installed on the machine.
For PPC, yeah currently the bindings.gyp file does not have the instructions to build for PPC. You will need to add Flags similar to the linux section and build it. I dont have a ppc box, might be I could seek your help to get a ppc box.
On the broken link I will need to find who could be the best contact to report about this. Will do.

12 ivyho commented Permalink

One interesting discovery to share - on the working window environment , we have 10.26 node js version and its equivalent npm.
One even strange thing is : we do not even need to set the path to point to the ibm_db libraries.

On the failing enviornment, we have 11.12 node and also I tried 10.26 node,
eventhough I set the path to point to the libraries things are failing.
ibm_db has dependencies on binding 0.0.1.
The default binding installed is 1.1.1
I tried to force to install the binding 0.0.1 , no difference in failure.
while in the working enviornment the bindings are 1.1.1 still works.
This looks like some kind of configuration dependent issues
In the failing environment, it seems that the ibm_db was recompiled with new objects and binaries.
What node.js and npm versions are you using?

13 ivyho commented Permalink

Some updates on this:

We can make it work in xLinux with the following instructions that Andrew Low from Lead of Nodejs runtime.
Instructions: make test directory - we'll call it foobar
$ mkdir foobar
$ cd foobar
$ mkdir node_modules
$ cd node_modules
$ unzip <path>/ibm_db_x64.zip
Now head back to foobar level directory
$ npm install bindings
Ok - now the tricky part(s) - we need the DB/2 driver & library files.
You want the "IBM Data Server Driver Package (DS Driver)" which will contain a bunch of stuff
Get that .tar.gz file (in my case it was ibm_data_server_driver_package_linuxx64_v10.5.tar.gz)
$ tar xzf <filename downloaded="downloaded">
Now look in the dsdriver/odbc_cli_driver/ directory for the appropriate driver. Mine was
Warning: This is going to be a problem on Power platforms, we need to find the right download
Ok - so we extract that file too. We should get a 'clidriver' directory with a bunch of sub directories.
Let's set some environment variables
$ export CPLUS_INCLUDE_PATH=<clidriver directory="directory">/include
$ export LIBRARY_PATH=<clidriver directory="directory">/lib
Now assuming we're still in foobar directory
$ cd node_modules
$ cd ibm_db
$ npm install
If all goes well, this should now compile clean.
Now we can setup to run a test - with one additional environment variable
$ export LD_LIBRARY_PATH=<clidriver directory="directory">/lib
and it works on a xLInux environment on nodejs 10.26
As far as windows environment is concerned, the results are
inconsistent on different machines.
Not all windows 7 machines work --
On the window 7 machine that works
mkdir Testdb2
cd Testdb2
npm install bindings
unzip the IBM_DB2.zip you provided.
Now under Testdb2\node_modules
we have bindings
and ibm_db
04/07/2014 10:18 AM
04/07/2014 10:18 AM
04/07/2014 10:15 AM
04/07/2014 10:18 AM
we need to install the IBM data server driver package
and have that in our path
We do not even need to set up any thing elese
Then it will work
C:\TestTim>node db2testing.js
creating a table
inserting 6 entries
all test module results
[ { MODULES: 'bcrypt', PASS: 15062, FAIL: 0 },
{ MODULES: 'request', PASS: 122, FAIL: 15 },
{ MODULES: 'colors', PASS: 90, FAIL: 0 },
{ MODULES: 'cheerio', PASS: 342, FAIL: 8 },
{ MODULES: 'jade', PASS: 146, FAIL: 0 },
{ MODULES: 'mongoose', PASS: 951, FAIL: 0 } ]
reading data selectively
test module results with 0 fails
[ { MODULES: 'bcrypt', PASS: 15062, FAIL: 0 },
{ MODULES: 'colors', PASS: 90, FAIL: 0 },
{ MODULES: 'jade', PASS: 146, FAIL: 0 },
{ MODULES: 'mongoose', PASS: 951, FAIL: 0 } ]
deleting entries with pass greater than 300
all test module results
[ { MODULES: 'request', PASS: 122, FAIL: 15 },
{ MODULES: 'colors', PASS: 90, FAIL: 0 },
{ MODULES: 'jade', PASS: 146, FAIL: 0 } ]
updating data
all test module results
[ { MODULES: 'request', PASS: 123, FAIL: 15 },
{ MODULES: 'colors', PASS: 91, FAIL: 0 },
{ MODULES: 'jade', PASS: 147, FAIL: 0 } ]
dropping table
However, if we ever try to do a npm install
inside the ibm_db.
that will show errors when compile.
But it does not seem to affect the execution .
We can still run okay in the windows environment,

14 Praveen Devarao commented Permalink

Hi Ivy,

Thanks for spending time on this. The zip file was only for windows x64, however given that you are kicking off a new compile that should not matter as the binary will get generated freshly.
Coming to setting env variables, did you try setting IBM_DB_HOME variable only and try, if yes, did you see any error?
The setting of CPLUS_INCLUDE_PATH and LIBRARY_PATH is good alternative in case IBM_DB_HOME is not working.
For PPC platform there is a IBM Data Server Driver Package that can be downloaded specific to the ppc platform. I guess you were mentioning the same in you warning.
Thanks for feedback on the windows package. Yes for windows currently it works only on 64-bit platforms with 64-bit DB2 client libraries. Also will need to ensure we are on stable node version.

15 ivyho commented Permalink

I would encourage you to start looking at nodejs 11.x.
If everyone waits for a stable version, then there will not be one.
Joyent node will declare their 11.x to be 12 when everyone contirbutes theirs to make it stable.
So we should be proactive and take leadership to be one step ahead.
Once they have declared version 12, is n't it nice that our IBM_DB is already available and ready?
Thank you for your effort and it is a good initiative.

Add a Comment Add a Comment
  • Previous Entry
  • Main
  • Next Entry