Coder Social home page Coder Social logo

zowe-cli-db2-plugin's Introduction

IBM® Db2® Database Plug-in for Zowe™ CLI

codecov

The IBM® Db2® Database Plug-in for Zowe™ CLI lets you interact with IBM® Db2® Database for z/OS and perform tasks with modern development tools to automate typical workloads more efficiently. The plug-in also lets you to interact with Db2 to advance continuous integration to validate product quality and stability.

How the plug-in works

The plug-in executes SQL statements against a Db2 region, export a Db2 table, and call a stored procedure.

The plug-in exposes its API so that the plug-in can be used directly in other products.

Software requirements

Before you install and use the plug-in:

  • Install Zowe CLI on your computer.

  • Have a license file for IBM Db2 Database for z/OS.

    For connectivity to Db2 for z/OS, the Db2 region should be db2connectactivated or a db2connect license file should be provided. Copy the db2connect license file to the [db2 plugin folder]/node_modules/ibm_db/installer/clidriver/license/ folder. For more information, see Addressing the license requirement on the Zowe Docs site.

  • (Linux and MacOS only) Download and install node-gyp globally by running npm install -g node-gyp

  • (MacOS only) Download and Install Xcode and Python 3.

  • (Linux only - Debian, Ubuntu) Download and Install the following via apt: python3 make g++

  • (Linux only - CentOS, RHEL) Download and Install the following via yum: python3 make gcc-c++

  • Note: Reinstallation is required when Node is upgraded to a new major version. When installed, the plug-in builds a native binary that is needed to interact with Db2. If a new major version of Node is installed, you must uninstall and reinstall the IBM Db2 Database Plug-in to update the binary.

Installing

Use one of the following methods to install the plug-in:

  • Install the plug-in from an online registry or a local package.

    Use the online registry/local package method when you simply want to install the plug-in to Zowe CLI and start using it.

    For more information, see Installing plug-ins on the Zowe Docs website.

  • Build the plug-in from source and install it into your Zowe CLI implementation.

    Use the build from source method when you want to install the plug-in to Zowe CLI using the most current binaries and modify the behavior of the plug-in. For example, you want to create a new command and use the plug-in with the command that you created.

    For more information, see Building from source.

Building from source

Follow these steps:

  1. The first time that you clone this plug-in from the GitHub repository, issue the following command against the local directory:

    npm install
    

    The command installs the required dependencies and several development tools. You can run the task at any time to update the tools as needed.

  2. To build your code changes, issue the following command:

    npm run build
    

    The first time you build your code changes, you will be prompted for the location of the Imperative CLI Framework package, which is located in the node_modules/@zowe folder in the Zowe CLI home directory.

    Note: When you update package.json to include new dependencies, or when you pull changes that affect package.json, issue the npm update command to download the dependencies.

  3. Issue one of the following commands to install the plug-in:

    zowe plugins install <local path your cloned repo>
    

    Or:

    zowe plugins install .
    

Tip: After the installation process completes, it validates that the plug-in was installed correct and the names of its commands, options, and arguments do not conflict with that of the other plug-ins that you installed into your Zowe CLi implimentation.

When the validation process is successful, the following message displays:

Validation results for plugin 'db2':
Successfully validated.

When an unsuccessful message displays, you can troubleshoot the installation by addressing the issues that the message describes. You can also review the information that is contained in the log file that is located in the Zowe CLI home directory.

Creating a user profile

After you install the plug-in, you create a Db2 profile. A Db2 profile is required to issue commands to the Db2 region. Db2 profiles contain your host, port, user name, password, and a database name for the IBM Db2 server of your choice. You can create multiple profiles and switch between them as needed.

Follow these steps:

  1. Create a Db2 profile:

    zowe profiles create db2 <profile name> -H <host> -P <port> -u <user> -p <password> -d <database>
    

    The result of the command displays as a success or failure message. You can use your profile when you issue commands in the Db2 command group.

Tip: For more information about the syntax, actions, and options, for a profiles create command, open Zowe CLI and issue the following command:

zowe profiles create db2 -h

Running tests

You can perform the following types of tests on the IBM DB2 plug-in:

  • Unit
  • Integration
  • System

For information about running automated, unit, and system and integration tests using the plug-in, see Zowe CLI Plug-in Testing Guidelines.

Before you can perform the tests, copy the file named .../__tests__/__resources__/properties/example_properties.yaml and create a file named .../__tests__/__resources__/properties/custom_properties.yaml.

Note: Information about the required values and how to customize the custom_properties.yaml file is provided in the yaml file itself.

Issue the following commands to run the tests:

  1. npm run test:unit
  2. npm run test:integration
  3. npm run test:system

Any failures potentially indicate an issue with the set-up of the Rest API or configuration parameters that were passed in the custom_properties.yaml file.

Uninstalling

Follow these steps:

  1. To uninstall the plug-in from a base application, issue the following command:
    zowe plugins uninstall @zowe/db2-for-zowe-cli
    
  2. Windows Only - The plug-in may encounter an error while uninstalling. If this occurs, run the uninstall command again.

After the uninstallation process completes successfully, the product no longer contains the plug-in configuration.

Troubleshooting

Node.js version incompatible with plug-in

Error message:

The module 'C:\Users\User\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\Release\odbc_bindings.node' was compiled against a different Node.js version using NODE_MODULE_VERSION ###. This version of Node.js requires NODE_MODULE_VERSION ###. Please try re-compiling or re-installing this module (for instance, using npm rebuild or npm install).

Action: Uninstall and reinstall the IBM Db2 Database Plug-in for Zowe CLI. The Node version installed on the system has changed since the IBM Db2 Database Plug-in for Zowe CLI was installed on the system, and the native binary is no longer compatible.

Contributing

For information about contributing to the plug-in, see the Zowe CLI Contribution Guidelines. The guidelines contain standards and conventions for developing plug-ins for Zowe CLI. This includes information about running, writing, maintaining automated tests, developing consistent syntax in your plug-in, and ensuring that your plug-in integrates properly with Zowe CLI.

Tutorials

To learn about building new commands or a new plug-in for Zowe CLI, see Develop for Zowe CLI.

Imperative CLI Framework documentation

Imperative CLI Framework documentation is a key source of information to learn about the features of Imperative CLI Framework (the code framework that you use to build plug-ins for Zowe CLI). Refer to the documentation as you develop your plug-in.

zowe-cli-db2-plugin's People

Contributors

atorrise avatar awharn avatar brandonjenkins14 avatar chrisboehmca avatar dependabot[bot] avatar giza-jenkins avatar jackjia-ibm avatar jamesbauman avatar jellypuno avatar markackert avatar raymondyanli avatar t1m0thyj avatar traeok avatar zfernand0 avatar zowe-robot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zowe-cli-db2-plugin's Issues

Plugin becomes unusable after an update of @zowe/cli

When updating @zowe/cli by npm, a validation phase of the Zowe plugins is triggered.
Validating the @zowe/db2-for-zowe-cli plugin triggers error messages:

_____ Validation results for plugin '@zowe/db2-for-zowe-cli' _____

*** CmdError: Failed to combine command definitions. Reason = Encountered an error loading one of the files (cli/call/Call.definition.js) that matched the provided command module glob for the glob function glob (pattern, options, cb) {
  if (typeof options === 'function') cb = options, options = {}
  if (!options) options = {}

  if (options.sync) {
    if (cb)
      throw new TypeError('callback provided to sync glob')
    return globSync(pattern, options)
  }

  return new Glob(pattern, options, cb)
}: Could not locate the bindings file. Tried:
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\Debug\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\Release\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\out\Debug\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\Debug\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\out\Release\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\Release\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\default\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\compiled\12.16.2\win32\x64\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\addon-build\release\install-root\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\addon-build\debug\install-root\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\addon-build\default\install-root\odbc_bindings.node
 → C:\Users\userid\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\lib\binding\node-v72-win32-x64\odbc_bindings.node

This plugin has command errors. No plugin commands will be available.

Actions:

  • uninstall plugin @zowe/db2-for-zowe-cli (version 4.0.7)
  • install plugin @zowe/db2-for-zowe-cli from npm registry (same version 4.0.7)
  • validate plugin @zowe/db2-for-zowe-cli : OK....

Strange ?

This is not the first time that the @zowe/db2-for-zowe-cli plugin become unusable and requires a complete uninstall / reinstallation.

Readme issue - Creating a user profile

The example CLI command for creating a db2 profile is throwing the following error

Unknown argument: p
Command failed due to improper syntax
Command entered: "zowe profiles create db2 myprofile -H myhost -P myport -u myuser -p mypw -d mydb"
Available commands are "zosmf-profile, tso-profile, ssh-profile, db2-profile, base-profile".
Use "zowe profiles create --help" to view groups, commands, and options.
Error Details:
Unknown argument: p

instead of
zowe profiles create db2 <profile name> -H <host> -P <port> -u <user> -p <password> -d <database>

it should be
zowe profiles create db2 <profile name> -H <host> -P <port> -u <user> --pw <password> -d <database>

according to the CLI help
--password | --pass | --pw

if I am not missing something, readme file needs a quick change 🙂

DB2 TABLE EXPORT and SQL0104N

I am using
-- pluginName: @brightside/db2
-- package: @brightside/db2
-- version: 2.1.1
-- registry: https://registry.npmjs.org/
on Windows 10, node V11.15.0, npm 6.7.0 and zos is 2.3, DB2 CODE LEVEL (V12R1M505 ).

While I can use zowe db2 client for SQL query, g Stored Procedures, db2 export table is failing with
PS C:\windows\system32> zowe db2 export table DSN81210.PROJ
Command Error:
Error: [IBM][CLI Driver][DB2] SQL0104N An unexpected token "," was found following "". Expected tokens may include: "
DISTINCT UNIQUE ALL * ARRAY + - ROW NEXTVAL PREVVAL NEXT". SQLSTATE=42601

on ZOS DB2 explain is showing
SELECT , , , , , , ,
FROM DSN81210.PROJ
FOR FETCH ONLY

zowe client instead of using column names from meta data, is sending ,,,,, to the query and hence failing.

Expect Error: Required object must be defined

Hello,
I was running the following command before and was working OK

zowe db2 execute sql -q 'select * from XX.YY'

But suddenly I am getting the following error:

Command Error:
Expect Error: Required object must be defined

Any idea what is wrong?

DB2 plugin feature to execute DB2 utilities also

@zszabo14 commented on Fri Jul 17 2020

Is your feature request related to a problem or limitation? Please describe.
Limitation

Describe the experience you'd like
I would like to execute DB2 utilities from ZOWE CLI. Like Load and Unload, Reorg, Runstat, Copy, Recover, Report, etc. Those are usually part of our automation scripts.

Describe alternatives you've considered
zowe db2 utility uload tablespace --tablespace --hlq --from

--fields --when ....

(of course I can execute them by running a JCL, but having a command for it would make programming easier)

Additional context


@Joe-Winchester commented on Fri Jul 17 2020

@zszabo14 - many thanks for raising this enhancement request. The DB2 CLI is part of the https://github.com/zowe/zowe-cli-db2-plugin repository so I'll copy this issue there so the squad who looks after the plugin can respond to the issue.

Node.js v10.11.0 support

From @tucker01 on September 25, 2018 23:18

I believe this is a known issue, going to documenting here...

On a system with Node.js v10.11.0, building the project from source results in the following error:

make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/jason/.nvm/versions/node/v10.11.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.15.0-34-generic
gyp ERR! command "/home/jason/.nvm/versions/node/v10.11.0/bin/node" "/home/jason/.nvm/versions/node/v10.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/home/jason/projects/zowe-cli-db2-plugin/node_modules/ibm_db/installer/clidriver"
gyp ERR! cwd /home/jason/projects/zowe-cli-db2-plugin/node_modules/ibm_db
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

    at ChildProcess.exithandler (child_process.js:289:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
  killed: false,
  code: 1,
  signal: null,
  cmd:
   'node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"' }

Attempting to install via plugins install command results in the following error:

``
prebuild-install WARN install No prebuilt binaries found (target=10.11.0 runtime=node arch=x64 platform=linux)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node installer/driverInstall.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/jason/.npm/_logs/2018-09-25T23_13_19_056Z-debug.log
Command Error:
Install Failed
Error Details:
Command failed: npm install "@brightside/db2@next" --prefix /home/jason/.brightside/plugins/installed -g --registry https://registry.npmjs.org/
``

Both tests were performed from an x64 Ubuntu 18.04.1 LTS and from a Docker image using FROM ubuntu:xenial.

For reference, the DB2 repo does not list Node.js v10 as a compatible release.

Copied from original issue: gizafoundation/zowe-cli-db2-plugin#3

ODBC driver error after update

Hi,

I have installed zowe CLI 6.16 and DB2 plugin from local packages. I set up the DB2 profile and I was able to execute the queries.

After the update to 6.20 (via online registry method) I am receiving the ODBC license errors:
image

Note: during the first installation, I did not set up ODBC driver at all.

Any advise is welcome.

Apply for Zowe V3 conformance

Describe your enhancement idea

When the V3 conformance program is available, apply for V3 conformance for this plug-in.

Create VSC extension for Db2 SQL

With Db2 plugin functionality, it seems to be straightforward to build a Visual Studio Code extension for basic Db2 SQL actions like: execute SQL and return SQL results. Such an extension could support highlighting - and this can be just ANSI SQL highlighting as Db2 SQL is very close to ANSI format.

Unable to uninstall DB2 from Zowe

From @AHumanFromCA on September 26, 2018 14:20

Opened this issue a while ago, I am transferring it over here since I do not see that it has been resolved yet.


I am unable to uninstall the DB2 plugin through Brightside.

The first uninstall attempt reports back that there is a locked file:

$ bright plugins uninstall @brightside/db2
npm ERR! path C:\Users\XXXXXXXX\.brightside\plugins\installed\node_modules\@brightside\db2\node_modules\ibm_db\installer\clidriver\bin\amd64.VC11.CRT
npm ERR! code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir
npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Users\XXXXXXXX\.brightside\plugins\installed\node_modules\@brightside\db2\node_modules\ibm_db\installer\clidriver\bin\amd64.VC11.CRT'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\XXXXXXXX\AppData\Roaming\npm-cache\_logs\2018-07-30T21_24_21_271Z-debug.log
Command Error:
Uninstall Failed
Error Details:
Command failed: npm uninstall "@brightside/db2" --prefix C:\Users\XXXXXXXX\.brightside\plugins\installed -g

Sometimes this will break npm cache and make DB2 uninstallable without a complete reinstall.

My theory is that the lock somehow is gathered by the bright process due to these observations.

  • It is always consistent that the first uninstall attempt fails at the ibm driver
  • Installing DB2 and manually executing the failed command npm uninstall "@brightside/db2" --prefix C:\Users\XXXXXXXX\.brightside\plugins\installed -g will uninstall the plugin's node folders every time.

That 2nd observation is why I believe that it isn't because of antivirus software.

App Version
Brightside 1.0.1
npm 6.0.0
Node 10.6.0
DB2 1.0.0

Copied from original issue: gizafoundation/zowe-cli-db2-plugin#4

IBM Db2 Connect Enterprise Edition has broken Zowe db2 plugin

Hi. I'm having trouble with my db2 plugin.

  1. I managed to install it a couple of months ago, but the "zowe plugins validate db2" showed "The specified plugin 'db2' has not been installed into your CLI application." Despite that, I could issue commands and queries to Db2 successfully.
  2. I then managed to get the Db2connect VSCode extension working nicely.
  3. I then tried to get Python talking to Db2/z, but kept on getting license errors - despite the fact that my enterprise license worked for the other plugins.
  4. I was told to install IBM Db2 Connect, which I did. Python STILL doesn't connect to Db2, and now the Zowe Db2 plugin has stopped working, and the Db2connect VSCode extension has stopped working.
    What can I do?

Incorrect Db2 Connect license file version in documentation

In this section of the documentation: https://docs.zowe.org/stable/user-guide/cli-db2plugin.html#addressing-the-license-requirement

it states "The license must be of version 11.1 if the Db2 server is not db2connectactivated"

In the ibm_db node module (which is what actually uses the license file) documentation it states: "[...] However, if you want to use node-ibm_db against DB2 for z/OS or DB2 for i(AS400) Servers, you must have db2connect license of version 11.5 if server is not db2connectactivated [...]". (https://www.npmjs.com/package/ibm_db#for-zos-and-iseries-connectivity)

I have only got this working with an 11.5 license file, so I believe this should be updated in the Zowe docs. This may have been caused by an update to the Db2 CLI Driver since the initial release of the Zowe Db2 plugin.

Failed to install db2 plugin.

I failed to install db2 plugin with Zowe 1.0, 1.2, 1.5, 1.7 on Linux.
OS: Red Hat Enterprise Linux Server release 7.6 (Maipo)
Nodejs: v10.17.0

Here are error logs:
11973 silly install [email protected]
11974 info lifecycle [email protected]install: [email protected]
11975 silly install [email protected]
11976 info lifecycle [email protected]
install: [email protected]
11977 silly install @brightside/[email protected]
11978 info lifecycle @brightside/[email protected]install: @brightside/[email protected]
11979 silly install [email protected]
11980 info lifecycle [email protected]
install: [email protected]
11981 verbose lifecycle [email protected]install: unsafe-perm in lifecycle false
11982 verbose lifecycle [email protected]
install: PATH: /usr/lib/node_modules/@brightside/core/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/root/.zowe/plugins/installed/lib/node_modules/@brightside/db2/node_modules/ibm_db/node_modules/.bin:/root/.zowe/plugins/installed/lib/node_modules/@brightside/db2/node_modules/.bin:/root/.zowe/plugins/installed/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
11983 verbose lifecycle [email protected]install: CWD: /root/.zowe/plugins/installed/lib/node_modules/@brightside/db2/node_modules/ibm_db
11984 silly lifecycle [email protected]
install: Args: [ '-c', 'node installer/driverInstall.js' ]
11985 silly lifecycle [email protected]install: Returned: code: 1 signal: null
11986 info lifecycle [email protected]
install: Failed to exec install script
11987 timing action:install Completed in 552ms
11988 verbose unlock done using /root/.npm/_locks/staging-be9b1d97b83c4b43.lock for /root/.zowe/plugins/installed/lib/node_modules/.staging
11989 timing stage:rollbackFailedOptional Completed in 775ms
11990 timing stage:runTopLevelLifecycles Completed in 16967ms
11991 warn @brightside/[email protected] requires a peer of @brightside/core@>=2.0.0-0 but none is installed. You must install peer dependencies yourself.
11992 warn @brightside/[email protected] requires a peer of @brightside/imperative@>=2.0.0-0 but none is installed. You must install peer dependencies yourself.
11993 warn [email protected] requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself.
11994 verbose stack Error: [email protected] install: node installer/driverInstall.js
11994 verbose stack Exit status 1
11994 verbose stack at EventEmitter. (/usr/lib/node_modules/@brightside/core/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
11994 verbose stack at EventEmitter.emit (events.js:198:13)
11994 verbose stack at ChildProcess. (/usr/lib/node_modules/@brightside/core/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
11994 verbose stack at ChildProcess.emit (events.js:198:13)
11994 verbose stack at maybeClose (internal/child_process.js:982:16)
11994 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
11995 verbose pkgid [email protected]
11996 verbose cwd /root/.zowe/plugins
11997 verbose Linux 3.10.0-1062.4.1.el7.x86_64
11998 verbose argv "/usr/bin/node" "/usr/lib/node_modules/@brightside/core/node_modules/npm" "install" "/root/Downloads/zowe-db2.tgz" "--prefix" "/root/.zowe/plugins/installed" "-g" "--registry" "https://registry.npmjs.org/"
11999 verbose node v10.17.0
12000 verbose npm v6.10.0
12001 error code ELIFECYCLE
12002 error errno 1
12003 error [email protected] install: node installer/driverInstall.js
12003 error Exit status 1
12004 error Failed at the [email protected] install script.
12004 error This is probably not a problem with npm. There is likely additional logging output above.
12005 verbose exit [ 1, true ]

Missing space in "zowe db2 execute sql" help page

Issuing zowe db2 execute sql -h yields the following help content where a space is missing in the first example between --query and "SELECT...

image

Node version: 10.13.0
Npm version: 6.4.1
Zowe CLI version: 5.9.1
Db2-plugin version: 3.0.1

Test with Typescript 3.2.2

Hello,

Please test upgrading typescript in your devDependencies to version to 3.2.2. When testing, please use the version of imperative and zowe CLI tagged @typescript3 on bintray which have been compiled with the same version. Verify that you can still compile and run your plug-in's commands. This will ensure your plugin will be compatible with a future update to zowe CLI and imperative that uses the new typescript version.

If all looks well after your testing, you can merge the change into your master branch

NodeJS v12 support

On a system with NodeJS v12, building the project from source results in the following error:

...
make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/home/user/node12test/zowe-cli-db2-plugin/node_modules/ibm_db/installer/clidriver"
gyp ERR! cwd /home/user/node12test/zowe-cli-db2-plugin/node_modules/ibm_db
gyp ERR! node -v v12.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

    at ChildProcess.exithandler (child_process.js:297:12)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"'
}
npm WARN @zowe/[email protected] requires a peer of @zowe/cli@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node installer/driverInstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2019-07-12T13_50_52_176Z-debug.log
App Version
Linux 4.15.0 64bit
NodeJS v12.6.0
NPM 6.9.0

Returning SQL results without ansi color coding

We are using the Zowe DB2 plugin in our own VS Code extension for making changes to DDL, and in our pipeline that deploys and executes these changes to DDL on DB2.

The result we receive from Zowe DB2 contains ansi encoding.
This makes it difficult to parse the result from a SQL, and requires a complex regex, that we would like to avoid maintaining.

We would like an option for Zowe DB2 SQL to return the result in plain text, thus making a parsing of the content easier.

Improved db2 profile invalid user credentials management

I am unsure if this request belongs here, or in the VS Code Zowe Explorer project.

As a company that wants to roll out more usage of Zowe amongst our developers, especially using VS Code,
We are running into issues with user accounts getting suspended on our Z, because the Zowe DB2 profile does not get updated, together with the regular Zowe profile, when Zowe detects that the password is incorrect, when using VS Code.
This leads to frustration amongst our developers, as it is not obvious what causes their accounts to get suspended.

Please implement, that requests to Z from Zowe DB2, does not continue after the first invalid password response is received from a call to Z.
If possible, also implement a way to easily update the password in VS Code, preferably at the same time as the update of the regular Zowe profile.

[Doc] xcode is a pre-req on Mac for the db2 plugin

I've been struggling to install the db2 plugin on my Mac for a long time. @zFernand0 helped me debug the issue and we found that the plugin installation was failing because of xcode missing on my Mac. xcode is a pre-req for the node ibm-db package that is uses by the zowe cli db2 plugin. Once we installed xcode, the db2 plugin installation worked. The doc should probably be updated to indicate this requirement.

Following is the error I used to see:

npm WARN @zowe/[email protected] requires a peer of @zowe/imperative@^3.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN @zowe/[email protected] requires a peer of @zowe/cli@^3.0.0 but none is installed. You must install peer dependencies yourself.



npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! [email protected] install: `node installer/driverInstall.js`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the [email protected] install script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.



npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/solsu01/.npm/_logs/2019-05-29T12_09_33_512Z-debug.log

Command Error:

Install Failed

No help for SQL0805N error in documentation

While installing the Db2 plugin, a number of users have experienced the following error when trying to use the plugin:

$ zowe db2 execute sql --query "select * from sysibm.SYSPACKAGE where pkgname like 'SQLC2H20'"
Command Error:
DB2 ODBC Driver Error: [node-ibm_db] Error in ODBCConnection::QuerySync while executing query.
Error Details:
Error:    [IBM][CLI Driver][DB2] SQL0805N  Package "DSNV112E.NULLID.SYSSH200.5359534C564C3031" was not found.  SQLSTATE=51002
SQLCODE:  -805
SQLSTATE: 51002

This is caused by a failure to run a bind enabling the Db2 CLI to be used against the database. In the ibm_db NPM documentation (the node module used for Db2 connectivity by the Zowe Db2 CLI), it provides some help regarding this error: https://www.npmjs.com/package/ibm_db#for-missing-packagebinding-issue

Could we also include this help in the Zowe docs for the plugin? I think this could be a common error, and is worth flagging as a gotcha to users.

Remove npm WARN errors from the CLI installation

Remove the WARN messages. These are causing issues for customers who get concerned about them.

These are caused by security issues in the request library and can be replaced by superagent library.

image

db2 webhelp and db2 cli commands not working despite plugins list saying its installed

Hi

Despite the db2 cli being installed , the webhelp is not showing and commands are not working correctly when trying to create a profile on Windows

C:\Users\TEST.zowe\plugins\installed\node_modules@zowe\db2-for-zowe-cli>zowe plugins list

Installed plugins:

-- pluginName: @zowe/secure-credential-store-for-zowe-cli
-- package: @zowe/secure-credential-store-for-zowe-cli@zowe-v1-lts
-- version: 4.1.0
-- registry: https://registry.npmjs.org/

-- pluginName: @zowe/cics-for-zowe-cli
-- package: @zowe/cics-for-zowe-cli@zowe-v1-lts
-- version: 4.0.2
-- registry: https://registry.npmjs.org/

-- pluginName: @zowe/db2-for-zowe-cli
-- package: @zowe/db2-for-zowe-cli
-- version: 4.0.6
-- registry: https://registry.npmjs.org/

-- pluginName: @zowe/ims-for-zowe-cli
-- package: @zowe/ims-for-zowe-cli@zowe-v1-lts
-- version: 2.0.1
-- registry: https://registry.npmjs.org/

-- pluginName: @zowe/mq-for-zowe-cli
-- package: @zowe/mq-for-zowe-cli@zowe-v1-lts
-- version: 2.0.1
-- registry: https://registry.npmjs.org/

-- pluginName: @zowe/zos-ftp-for-zowe-cli
-- package: @zowe/zos-ftp-for-zowe-cli@zowe-v1-lts
-- version: 1.2.0
-- registry: https://registry.npmjs.org/

no db2 help available

image

Confusing command error messages

When attempting to issue the following command (no profiles exist):

zowe db2 execute sql --query <query text>

I get the following response:

Command Error:
Expect Error: Required parameter 'hostname' must be defined

However, there is no hostname option. Only host:

   --host  | -H (string)

      The Db2 server host name

Also, this message differs from most other syntax errors e.g.:

Syntax Error:
You must specify one of the following options for this command:
[--query, --file]

Example:

 - Execute a dummy SQL query:

      $ zowe db2 execute sql --query"SELECT 'Hello World' FROM SYSIBM.SYSDUMMY1"

Use "zowe db2 execute sql --help" to view command description, usage, and options.

Failure to install on Windows with Node 18.16.0

Related to ibmdb/node-ibm_db#920

@anaxceron Can we document this as a known issue?
Affected users: Anyone installing the DB2 plugin for Zowe CLI on Windows with Node 18.16.0
Workaround: Uninstall Node.js 18.16.x and downgrade to Node.js 18.15.x, then reinstall the plugin.

_____ Validation results for plugin '@zowe/db2-for-zowe-cli' _____

*** CmdError: Failed to combine command definitions. Reason = Encountered an error loading one of the files (cli/call/Call.definition.js) that matched the provided command module glob for the glob function glob (pattern, options, cb) {
  if (typeof options === 'function') cb = options, options = {}
  if (!options) options = {}

  if (options.sync) {
    if (cb)
      throw new TypeError('callback provided to sync glob')
Problems detected during plugin validation. Please check above for more information.
    return globSync(pattern, options)
  }

  return new Glob(pattern, options, cb)
}: \\?\C:\Users\runneradmin\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\Release\odbc_bindings.node is not a valid Win32 application.
\\?\C:\Users\runneradmin\.zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\build\Release\odbc_bindings.node

SSL error connecting to Db2

I receive the below error when attempting any zowe db2 command. Our z/OS Db2 server is setup with ATTLS, I can see in the logs that ATTLS is failing with RC 541 which indicates the client doesn't like the server's certificate. Db2's certificate is signed by an internal CA which I have configured node to trust (see NODE_EXTRA_CA_CERTS screenshot) - this setup works with other zowe commands without using the --ru false cli argument. zOSMF's server certificate is signed by the same CA as Db2.

I can't find any way of printing tls trace output from the zowe db2 commands, using the --trace-tls NODE_OPTIONS variable works for other zowe commands but not db2m I suspect it's because of the CLI driver that db2 plugin requires.

Are there any debug/trace options I can use with the db2 plugin to see what's going on? I'm in the open mainframe Slack channel, happy to be contacted there.

image
image

Incorrect license location in documentation

In this section of the installation documentation:
https://docs.zowe.org/stable/user-guide/cli-db2plugin.html#addressing-the-license-requirement

it says to place the license file here:

<zowe_home>/plugins/installed/lib/node_modules/@zowe/db2/node_modules/ibm_db/installer/clidriver/license

(and similar for Windows)

The license location should be here:

<zowe_home>/plugins/installed/lib/node_modules/@zowe/db2-for-zowe-cli/node_modules/ibm_db/installer/clidriver/license

(and similar for Windows)

Failing System Tests

There are 4 failing system tests, all failing on the line:
expect(new RegExp(regex, "gs").test(response.stdout.toString())).toBe(true);.

Multiple Snapshot failures due to additional options added, so need updating.

Screenshot 2020-12-15 at 11 16 16

Screenshot 2020-12-15 at 11 06 48

Dependency on node.js/npm version and incompatibility with nvm (node.js version manager)

We use the nvm software, node.js version manager, to be able to quickly switch from one version of node.js to another.
This is a need of our organization.

With nvm, each version of node.js/npm is installed in a different folder, with a subfolder containing the npm modules.
@zowe/cli is an npm module, and therefore when activating a node.js/npm version for the first time, the @zowe/cli module must be reinstalled.
The installation of @zowe/cli detects previous installation of zowe plugins which are installed outside of the npm modules subfolder.

We noticed, during a version switch of node.js to an earlier version, that the plugin @zowe/db2-for-zowe-cli was dependent on the npm version used when it was installed:

>nvm list
  * 16.0.0  (Currently using 64-bit executable)
    14.17.0 
  
> nvm use 14.17
14.17.0

> npm install -g @zowe/cli
 @zowe/[email protected] postinstall C:\Users\{username}\node_modules\@zowe\cli
> node ./scripts/validatePlugins

Since you re-installed Zowe CLI, we are re-validating any plugins.

_____ Validation results for plugin '@zowe/cics-for-zowe-cli' _____
This plugin was successfully validated. Enjoy the plugin.

_____ Validation results for plugin '@zowe/zos-ftp-for-zowe-cli' _____
This plugin was successfully validated. Enjoy the plugin.

_____ Validation results for plugin '@broadcom/endevor-for-zowe-cli' _____
This plugin was successfully validated. Enjoy the plugin.

_____ Validation results for plugin '@broadcom/endevor-bridge-for-git-for-zowe-cli' _____
This plugin was successfully validated. Enjoy the plugin.

_____ Validation results for plugin '@ibm/rse-api-for-zowe-cli' _____
This plugin was successfully validated. Enjoy the plugin.

_____ Validation results for plugin '@zowe/db2-for-zowe-cli' _____

*** CmdError: Failed to combine command definitions. Reason = Encountered an error loading one of the files (cli/call/Call.definition.js) that matched the provided command module glob for the glob function glob (pattern, options, cb) {
  if (typeof options === 'function') cb = options, options = {}
  if (! options) options = {}

  if (options.sync) {
    if (cb)
      throw new TypeError ('callback provided to sync glob')
    return globSync (pattern, options)
  }

  return new Glob (pattern, options, cb)
}: The module '\\?\C:\Users\{username}\.Zowe\plugins\installed\node_modules\@zowe\db2-for-zowe-cli\node_modules\ibm_db\​​build\Release\odbc_bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or` npm install`).

This plugin has command errors. No plugin commands will be available.

npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\{username}\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\{username}\package.json'
npm WARN {username} No description
npm WARN {username} No repository field.
npm WARN {username} No README data
npm WARN {username} No license field.

+ @zowe/[email protected]
added 287 packages from 202 contributors and audited 287 packages in 84.572s

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> zowe --version
'zowe' is not recognized as an internal command
or external, an executable program or a batch file.

> npm list -g --depth = 0
C:\ProgramData\ nodejs
`- [email protected]

Because of this, the @zowe/cli module cannot be installed on the newly activated node.js version.

To solve the problem, you must:

  • switch back to the old node.js version
  • uninstall the @zowe/db2-for-zowe-cli plugin
  • switch back to the new node.js version
  • install the npm @zowe/cli module
  • reinstall the @zowe/db2-for-zowe-cli plugin

Exclude node_modules from test-tsconfig.json

This same issue may apply to other plugins as well.
Solution:

  • Remove fs-extra from the __tests__/__src__/environment/TestEnvironment.ts

Downgraded @types/fs-extra for various reasons:

  • the test-tsconfig.json cannot properly exclude the @types/fs-extra package since the TestEnvironment.ts uses if for mkdirpSync
  • tsconfig.json has to include it's node_modules/typings. See https://stackoverflow.com/a/67512016/16555983
  • @types/fs-extra@^9.0.5 has issues that we may be able to avoid with
    tsconfig.json#compilerOptions.skipLibCheck: true

Note: We may have to upgrade to newer versions of this package for security reasons.

Originally posted by @zFernand0 in #85 (comment)

Unit tests failing on Windows

Some unit tests fail on Windows + Node.js 14 with this error:

    The specified module could not be found.
    \\?\C:\dev\zowe-cli-db2-plugin\node_modules\ibm_db\build\Release\odbc_bindings.node

      at Runtime._loadModule (node_modules/jest-runtime/build/index.js:572:29)
      at bindings (node_modules/bindings/bindings.js:112:48)
      at Object.<anonymous> (node_modules/ibm_db/lib/odbc.js:57:31)

Adding zowe-cli-db2-plugin/node_modules/ibm_db/installer/clidriver/bin to PATH fixes the issue (as suggested here).

Improve error message for "zowe db2 call procedure"

zowe db2 call procedure "SYSPROC.ADMIN_INFO_SYSPARM(?)" --parameters "xxxx"
returns error message:
(empty array)

Suggestions:

  1. Improve documentation and built-in help to state that both input and output parameters should be passed, i.e., correct command is
    zowe db2 call procedure "SYSPROC.ADMIN_INFO_SYSPARM(?,?,?)" --parameters "xxxx" "xxxx" "xxxx"
  2. Improve error message instead of just showing empty array

Export table does not generate statement separator

The current version does NOT generate an ‘end-of-statement’ character. As a result, the output file would have to be edited in order for it to be useful with for example zowe excute sql to use the generated statements. Perhaps it makes sense to add an option to generate or suppress the option.

Update the plug-in to be compatible with Zowe CLI V3 and prepare for Zowe V3 conformance

Is your feature or enhancement request related to a problem or limitation? Please describe

Zowe V3 is scheduled to be released at the end of March 2024. This plug-in should also be available for users upgrading to V3.

Describe your enhancement idea

The open source plug-ins should be updated to be compatible with Zowe CLI V3 (8.x.x) and should be in a state where it fulfills the requirements for Zowe V3 conformance.

Once the Zowe V3 conformance program application is available, we will need to apply for conformance for this plug-in (#145).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.