Copyright (c) 2014 IBM Corporation and/or its affiliates. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Overview
- ibm_db Installation on Linux
- ibm_db Installation on AIX on Power Systems
- ibm_db Installation on Linux on System z
- ibm_db Installation on Linux on Power System
- ibm_db Installation on MacOS
- ibm_db Installation on Windows
- ibm_db Installation on z/OS
- ibm_db How to Manually Build on Windows
- ibm_db installation on MacOS M1/M2 Chip System
The node-ibm_db is an asynchronous/synchronous interface for node.js to IBM DB2 and IBM Informix.
Following are the steps to create a Node.js installation for testing.
This node-ibm_db driver has been tested on 64-bit/32-bit IBM Linux, IBM AIX, MacOS, Linux on z, Linux on Power System and Windows.
Download the
Node.js Linux binaries or Node.js Latest binaries and
extract the file, for example into /mynode
:
cd /mynode
tar -xzf node-v4.2.2-linux-x64.tar.gz
Set PATH to include Node.js:
export PATH=/mynode/node-v4.2.2-linux-x64/bin:$PATH
Following are the steps to install node-ibm_db from github or npm.
using directory /nodeapp
for example.
1. mkdir nodeapp
2. cd nodeapp
3. npm install ibm_db
or
npm install git+https://[email protected]/ibmdb/node-ibm_db.git
- Install other packages mentioned in package.json as devDependencies
npm install async bluebird moment
- Update config.json with your credentials and run test.
cd node_modules/ibm_db/test/
vi config.json => Update connection string in this file.
node run-tests.js
It's Done.
1. mkdir nodeapp
2. cd nodeapp
3. git clone https://github.com/ibmdb/node-ibm_db/
4. Set "IBM_DB_HOME" with 'clidriver' path, for example clidriver path is : /home/mysystem/clidriver
export IBM_DB_HOME=/home/mysystem/clidriver
5. Install node-gyp and other dependencies (refer package.json)
npm install -g node-gyp
npm install moment async bluebird
npm install nan bindings adm-zip q request targz
etc...
6. Set "/node-ibm_db/node_modules/" path into system PATH.
export PATH=/home/mysystem/nodeapp/node-ibm_db/node_modules/.bin:$PATH
7. Run node-gyp configure build command.
node-gyp configure build --IBM_DB_HOME=$IBM_DB_HOME --IS_DOWNLOADED=false --verbose
8. Update config.json with your credentials and run test.
cd node-ibm_db/test/
vi config.json => Update database connection info.
node run-tests.js
It's Done.
Download the
Node.js AIX binaries from IBM SDK for Node.js and
execute the binary file, for example into /mynode
:
cd /mynode
./ibm-4.4.3.0-node-v4.4.3-aix-ppc64.bin
Follow the same steps mentioned in Node-ibm_db Installation on Linux.
Download the
Node.js Linux on System z binaries from IBM SDK for Node.js and
execute the binary file, for example into /mynode
:
cd /mynode
./ibm-4.4.3.0-node-v4.4.3-linux-s390x.bin
Follow the same steps mentioned in Node-ibm_db Installation on Linux.
Download the
Node.js Linux on Power System binaries from IBM SDK for Node.js and
execute the binary file, for example into /mynode
:
cd /mynode
./ibm-4.4.3.0-node-v4.4.3-linux-ppc64.bin
Follow the same steps mentioned in Node-ibm_db Installation on Linux.
Download the Node.js MacOS binaries or Node.js Latest binaries and extract the file.
Follow the same steps mentioned in Node-ibm_db Installation on Linux.
Download the Node.js Windows binary/installer or Node.js Latest binaries and install it.
Following are the steps to install node-ibm_db from github or npm.
using directory /nodeapp
for example.
1. mkdir nodeapp
2. cd nodeapp
3. npm install ibm_db
or
npm install git+https://[email protected]/ibmdb/node-ibm_db.git
- Install other packages mentioned in package.json as devDependencies
npm install async bluebird moment
- Update config.json with your credentials and run test.
cd node_modules/ibm_db/test/
vi config.json => Update connection string in this file.
node run-tests.js
It's Done.
Download and install the IBM SDK for Node.js - z/OS from Marketplace. Given that ibm_db includes native add-on code, ensure that you have the pre-requisite Python and Make tools installed as detailed in the SDK installation instructions.
Please refer to the ODBC Guide and References cookbook for how to configure your ODBC driver. Specifically, you need to ensure you have:
-
Apply Db2 on z/OS PTF UI60551 to pick up new ODBC functionality to support Node.js applications.
-
Binded the ODBC packages. A sample JCL is provided in the
SDSNSAMP
dataset in memberDSNTIJCL
. Customize the JCL with specifics to your system. -
Set the
IBM_DB_HOME
environment variable to the High Level Qualifier (HLQ) of your Db2 datasets. For example, if your Db2 datasets are located asDSNC10.SDSNC.H
andDSNC10.SDSNMACS
, you need to setIBM_DB_HOME
environment variable toDSNC10
with the following statement (can be saved in~/.profile
):# Set HLQ to Db2 datasets. export IBM_DB_HOME="DSNC10"
-
Update the
STEPLIB
environment variable to include the Db2 SDSNEXIT, SDSNLOAD and SDSNLOD2 data sets. You can set theSTEPLIB
environment variable with the following statement, after definingIBM_DB_HOME
to the high level qualifier of your Db2 datasets as instructed above:# Assumes IBM_DB_HOME specifies the HLQ of the Db2 datasets. export STEPLIB=$STEPLIB:$IBM_DB_HOME.SDSNEXIT:$IBM_DB_HOME.SDSNLOAD:$IBM_DB_HOME.SDSNLOD2
-
Configured an appropriate Db2 ODBC initialization file that can be read at application time. You can specify the file by using either a DSNAOINI data definition statement or by defining a
DSNAOINI
z/OS UNIX environment variable. For compatibility with ibm_db, the following properties must be set:In COMMON section:
MULTICONTEXT=2 CURRENTAPPENSCH=ASCII FLOAT=IEEE
In SUBSYSTEM section:
MVSATTACHTYPE=RRSAF
Here is a sample of a complete initialization file:
; This is a comment line... ; Example COMMON stanza [COMMON] MVSDEFAULTSSID=VC1A CONNECTTYPE=1 MULTICONTEXT=2 CURRENTAPPENSCH=ASCII FLOAT=IEEE ; Example SUBSYSTEM stanza for VC1A subsystem [VC1A] MVSATTACHTYPE=RRSAF PLANNAME=DSNACLI ; Example DATA SOURCE stanza for STLEC1 data source [STLEC1] AUTOCOMMIT=1 CURSORHOLD=1
Reference Chapter 3 in the ODBC Guide and References for more instructions.
The following are the steps to install node-ibm_db from GitHub or npm into a subdirectory nodeapp
as an example.
From Unix System Services (USS), create a subdirectory nodeapp
to host your Node.js application:
mkdir nodeapp
cd nodeapp
Install ibm_db from npm, or from the GitHub repository (requires Git on z/OS):
# Install via npm repository
npm install ibm_db
# --- OR -----
# Install from GitHub repository
npm install git+ssh://[email protected]/ibmdb/node-ibm_db.git
Using Git on z/OS, clone the GitHub respository.
git clone git://github.com/ibmdb/node-ibm_db
cd node-ibm_db
Install the ibm_db module dependencies with:
npm install
To run the validation tests, update node-ibm_db/test/config.zos.json
with your database credentials (DSN, UID, PWD).
Set the IBM_DB_SERVER_TYPE
environment variable to "ZOS"
if you are connecting to a z/OS Db2 database.
export IBM_DB_SERVER_TYPE="ZOS"
Execute the tests with:
cd node-ibm_db
npm test
Download the Node.js Windows binary/installer or Node.js Latest binaries and install it.
Following are the steps to make build of node-ibm_db.
using directory /nodeapp
for example.
1. mkdir nodeapp
2. cd nodeapp
3. git clone https://github.com/ibmdb/node-ibm_db/
-
Download platform specific clidriver from https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ , untar/unzip it and set
IBM_DB_HOME
environmental variable to full path of extracted 'clidriver' directory, for example if clidriver is extracted as:/home/mysystem/clidriver
, then set system level environment variableIBM_DB_HOME=/home/mysystem/clidriver
. -
Set the msbuild path into
PATH
environment variable. ie.:C:\Program Files (x86)\MSBuild\14.0\bin\
. -
Build odbc_bindings.node using npm command
cd node-ibm_db
npm install
- Check for
\node-ibm_db\build\Release\odbc_bindings.node
file, If it's there Well Done :)
[email protected] onwards supports native installation on MacOS ARM64(M* Chip/Apple Silicon Chip) system using clidriver/dsdriver version 12.1.0.
Follow same steps as documented for [Node-ibm_db Installation on MacOS](#insmac)