ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
188 stars 151 forks source link

Q: z/OS license being cached ? #993

Closed lucaskuperman closed 2 months ago

lucaskuperman commented 2 months ago

I'm running ibm_db (3.2.4) on my Windows 11 , trying to connect to db2 z/OS v11.5 As expected, I am not able to connect due to SQL1598N until I apply a license. So I applied a license and worked. But then I came across this behavior which is counterintuitive: why are connections still working after deleting the mentioned license file? Why are they still working even after deleting the entire node_modules folder and installing everything again? Is the license being cached? where? and by whom?

It would be helpful for me to understand this behavior, so I can then pursue connecting without a client-side license by enabling db2connectactivated

For Connection related issue

  1. Are you trying SSL connection or non-SSL connection? non-SSL

  2. Share the connection string used for connection by masking password. DATABASE=DQAP;HOSTNAME=riosys2.boulder.ibm.com;PORT=5033;UID=umarfun;PWD=***;

  3. For non-SSL connection, update connection info for db2cli validate command in file ibm_db/installer/testODBCConnection.bat for windows or ibm_db/installer/testODBCConnection.sh for non-Windows. Then execute testODBCConnection.bat from Administrator command prompt on Windows or testODBCConnection.sh script from terminal on non-Windows and share complete output of script along will all generated 1.* files in zip file.

  4. Complete output of db2cli validate command.

Trace is turned on

=============================================================================== Client information for the current copy (copy name: C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver):

Client Package Type : IBM Data Server Driver For ODBC and CLI Client Version (level/bit): DB2 v11.5.9000.832 (special_36648/64-bit) Client Platform : NT 64BIT Install/Instance Path : C:\Users\052664613\git\umar\umar-fun\node_modules\ibm_db\installer\clidriver

Common App Data Path : C:\ProgramData\IBM\DB2\C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver DB2DSDRIVER_CFG_PATH value: db2dsdriver.cfg Path : \cfg\db2dsdriver.cfg DB2CLIINIPATH value : db2cli.ini Path : \cfg\db2cli.ini db2diag.log Path : \db2diag.log

=============================================================================== List of all IBM Data Server client packages on the current workstation:

Copyname Version Package Language Installed-Location

C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver[C] 11.5.0900 CLI EN C:\Users\052664613\git\umar\umar-fun\node_modules\ibm_db\installer\clidriver

CLI: IBM Data Server Driver for ODBC and CLI

=============================================================================== db2dsdriver.cfg schema validation for the entire file:

Note: The validation utility could not find the configuration file db2dsdriver.cfg. The file is searched at "C:\ProgramData\IBM\DB2\C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver\cfg\db2dsdriver.cfg".

=============================================================================== db2cli.ini validation for database "DQAP:riosys2.boulder.ibm.com:5033":

Note: The validation utility could not find the configuration file db2cli.ini. The file is searched at "C:\ProgramData\IBM\DB2\C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver\cfg\db2cli.ini".

=============================================================================== db2dsdriver.cfg validation for database "DQAP:riosys2.boulder.ibm.com:5033":

Note: The validation utility could not find the configuration file db2dsdriver.cfg. The file is searched at "C:\ProgramData\IBM\DB2\C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver\cfg\db2dsdriver.cfg".

=============================================================================== Connection attempt for database "DQAP:riosys2.boulder.ibm.com:5033":

[SUCCESS]

Output Connection String : "UID=umarfun;PWD=****;DATABASE=DQAP;HOSTNAME=riosys2.boulder.ibm.com;PORT=5033;"

=============================================================================== The validation is completed.

Trace is turned off Total number of trace records : 16619 Trace truncated : NO Trace wrapped : NO Number of trace records formatted : 12 (pid: 97520 tid 97380 node: -1) Number of trace records formatted : 15925 (pid: 6160 tid 7568 node: -1) Number of trace records formatted : 136 (pid: 80516 tid 85796 node: -1) Trace truncated : NO Trace wrapped : NO Total number of trace records : 16619 Number of trace records formatted : 16073 Trace truncated : NO Trace wrapped : NO Total number of trace records : 16619 Number of trace records formatted : 16 Trace truncated : NO Trace wrapped : NO Total number of trace records : 16619 Number of trace records formatted : 546

For SQL1598N Error

bimalkjha commented 2 months ago

@lucaskuperman Yes, the license info get cached under Common App Data Path as displayed in db2cli validate output and it is C:\ProgramData\IBM\DB2\C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver in your case.

When ibm_db and actually clidriver tries to connect to Db2 for z/OS or Db2 for iSeries server, license check happens for first connection and get stored in cache file on disk. The license may be at client side or on server using db2connectactivate utility. clidriver checks for both client and server side db2connect license. If a valid license found, clidriver cache the license info in Common App Data Path\license\nodelock and nodelock.bak files for Windows and in Install Dir\license\nodelock and nodelock.bak files for non-Windows systems. Next license check happens after 7 days only. Till 7 days, if clidriver founds license info in cache, it allows connection. License info also get cached in .....clidriver\cfgcache\conlic.bin file for server side db2connect license.

So, to enforce license check after deleting the license file, you need to delete C:\ProgramData\IBM\DB2\C_Users_052664613_git_umar_umar-fun_node_modules_ibm_db_installer_clidriver\license\nodelock* files. Thanks.