diff --git a/README.md b/README.md index 79f47ec..ffcadcf 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ibm_db: 2.8.1 - For Node.js >= V15.x on RHEL and RHEL 8.x, GCC v8.2.1 is required. -- The latest node.js version using which `ibm_db` is tested: 20.0.0 +- The latest node.js version using which `ibm_db` is tested: 20.2.0 ## Install @@ -128,6 +128,14 @@ To avoid this download, you can manually download clidriver from this location o - TIP: - If you don't have alternate hosting URL then, you can download the tar/zipped file of clidriver from the [IBM Hosted URL](#downloadCli) and can set the **IBM_DB_INSTALLER_URL** environment variable to the downloaded "tar/zipped clidriver's" parent directory path. No need to untar/unzip the clidriver and do not change the name of downloaded file. +`DOWNLOAD_CLIDRIVER :` + +- USE: + - Set this environment variable to force downloading of odbc/clidriver. If clidriver is already present, existing clidriver will get deleted. If IBM_DB_HOME environment variable is set, still clidriver will get downloaded by ignoring value of IBM_DB_HOME. + +- HOW: + - On distributed platforms, Set **DOWNLOAD_CLIDRIVER** environment variable to `true` to force downloading of clidriver from IBM hosted URL. Never set DOWNLOAD_CLIDRIVER on z/OS system. + ### Download clidriver ([based on your platform & architecture](#systemDetails)) from the below IBM Hosted URL: > [DOWNLOAD CLI DRIVER](https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/) diff --git a/build.zip b/build.zip index 5dd8800..a487214 100644 Binary files a/build.zip and b/build.zip differ diff --git a/installer/driverInstall.js b/installer/driverInstall.js index 66e7846..1c9c88e 100644 --- a/installer/driverInstall.js +++ b/installer/driverInstall.js @@ -101,27 +101,36 @@ var install_node_ibm_db = function(file_url) { */ //If building for supporting VSCode Extn, then remove Clidriver folder and get it freshly - if(vscode_build && fs.existsSync(path.join(DOWNLOAD_DIR,'clidriver'))){ - deleteFolderRecursive(path.join(DOWNLOAD_DIR,'clidriver')) + //If environment variable DOWNLOAD_CLIDRIVER is set to true, then remove Clidriver folder and get it freshly + if((vscode_build || process.env.DOWNLOAD_CLIDRIVER == "true") && + fs.existsSync(path.join(DOWNLOAD_DIR,'clidriver'))){ + deleteFolderRecursive(path.join(DOWNLOAD_DIR,'clidriver')); + } + + //If environment variable DOWNLOAD_CLIDRIVER is set to true, then ignore setting of IBM_DB_HOME + if(process.env.DOWNLOAD_CLIDRIVER == "true"){ + process.env.IBM_DB_HOME = ''; + printMsg('DOWNLOAD_CLIDRIVER environment variable is set, ' + + 'proceeding to download clidriver.\n'); } // Check if env var IBM_DB_HOME is set var IS_ENVIRONMENT_VAR; - var clidriverFound = true; + var clidriverFound = false; if (process.env.IBM_DB_HOME) { if (fs.existsSync(process.env.IBM_DB_HOME) || platform == "os390") { IBM_DB_HOME = process.env.IBM_DB_HOME; IS_ENVIRONMENT_VAR = true; + clidriverFound = true; } else { printMsg(process.env.IBM_DB_HOME + " directory does not exist. Please" + " check if you have set the IBM_DB_HOME environment" + " variable\'s value correctly.\n"); - clidriverFound = false; } } - if (clidriverFound == false && fs.existsSync(DOWNLOAD_DIR + "/clidriver")){ + if (clidriverFound == false && fs.existsSync(DOWNLOAD_DIR + "/clidriver/include/sqlcli.h")){ IBM_DB_HOME = path.resolve(DOWNLOAD_DIR, 'clidriver'); process.env.IBM_DB_HOME = IBM_DB_HOME.replace(/\s/g,'\\ '); IS_ENVIRONMENT_VAR = false; @@ -139,6 +148,7 @@ var install_node_ibm_db = function(file_url) { } else { IBM_DB_LIB = path.resolve(IBM_DB_HOME, 'lib'); } + clidriverFound = true; if (!fs.existsSync(IBM_DB_LIB)) { console.log(IBM_DB_LIB, " directory does not exist. Please ", @@ -161,8 +171,6 @@ var install_node_ibm_db = function(file_url) { process.env.IBM_DB_HOME = undefined; } } - } else { - clidriverFound = false; } /*