ibmdb / node-ibm_db

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

GSKit Error: 102 #906

Closed giselle-says closed 1 year ago

giselle-says commented 1 year ago

Hi all,

Hope you are doing well,

I´m having GSKit error trying db2 connection, I already verify the error in IBM documentation (IBM Global Security Kit return codes & SSL initialization messages)

I´m created keystore using GSKit tool, I used full path & relative path but still not reading the keystore, below errors using path mentioned:

Relative Path

[Error: [IBM][CLI Driver] SQL1109N  The command was not processed because the database manager failed to load the following DLL: "GSKit Error: 102".  SQLSTATE=42724
] {
  error: '[ibm_db] SQL_ERROR',
  sqlcode: -1109,
  state: '42724'
}

Full path

[Error: [IBM][CLI Driver] SQL1109N  The command was not processed because the database manager failed to load the following DLL: "GSKit Error: 202".  SQLSTATE=42724
] {
  error: '[ibm_db] SQL_ERROR',
  sqlcode: -1109,
  state: '42724'
}

I also tried connect to DB only using JS, it works but when use query method & I got "Error opening a file"

[Error: [IBM][CLI Driver] CLI0157E  Error opening a file. SQLSTATE=HY507] {
  error: '[ibm_db] SQL_ERROR',
  sqlcode: -99999,
  state: 'HY507'
}

Hope can help me to see what is missing.

Thanks in advance,

bimalkjha commented 1 year ago

@GiselleArroyo The GSKit Error 102 => GSK_KEYFILE_IO_ERROR and 202 => GSK_KEYRING_OPEN_ERROR We should always use the Full Path for keydb, keystash or certificate file. ibm_db do not understand the relative path. If you do not have any specific reason to create keydb using GSKit command and you already have SSL Certificate of server, then no need to create keydb. You can directly point the full path of certificate.arm file using SSLServerCertificate keyword in connection string. We want to check your connection string to know more about issue. Please share your connection string that you pass to the ibm_db, you can mask the info but we want to know the syntax and keywords used in connection string. Better you try to reproduce the issue using a simple test program with connection string and share the test file here. You can also modify any ibm_db/test/test-*.js file and add connection string to it and then run it. About "Error opening a file" error, you need to check permission of the file. Thanks.

giselle-says commented 1 year ago

Understood, string connection:

var connString = "DRIVER={DB2};DATABASE=dbname;UID=email@ibm.com;PWD=password;HOSTNAME=;port=443;PROTOCOL=TCPIP;Security=SSL;SSLServerCertificate=C:\Users\windowsUser\Documents\cert.arm;";

I modified test-basic-test.js, I got the same error:

[Error: [IBM][CLI Driver] CLI0157E  Error opening a file. SQLSTATE=HY507] {
  error: '[ibm_db] SQL_ERROR',
  sqlcode: -99999,
  state: 'HY507'
}

I 

I tried adding permissions but still showing the error, do you know what´s the proper way to make the permissions change in windows?

Regards,

bimalkjha commented 1 year ago

@GiselleArroyo Please use below connection string:

var connString = "DATABASE=dbname;UID=dbuser;PWD=dbpass;HOSTNAME=myhost.ibm.com;port=443;PROTOCOL=TCPIP;Security=SSL;SSLServerCertificate=C:\\Users\\windowsUser\\Documents\\cert.arm;";

Value of UID should be the userid of target Db2 server not your emailid. Also, path of certificate on windows should be separated by \. Single \ is considered as escape character and form a wrong file path and hence, Error in opening a file. Thanks.

giselle-says commented 1 year ago

Bimal,

Thanks for shared the string, I placed it and now I got this error,

[Error: [IBM][CLI Driver] SQL1109N  The command was not processed because the database manager failed to load the following DLL: "GSKit Error: 2".  SQLSTATE=42724
] {
  error: '[ibm_db] SQL_ERROR',
  sqlcode: -1109,
  state: '42724'
}

I found the error in IBM website (https://www.ibm.com/docs/en/spectrum-protect/8.1.9?topic=codes-global-security-kit-return) " The environment or SSL handle is not valid. The specified handle was not the result of a successful open() function call."

Regards,

bimalkjha commented 1 year ago

@GiselleArroyo This error is coming due to multiple versions of GSKit library in your system. Please check your system environment variables PATH and LIB. If they have gsk, it should be removed or add full path of clidriver/lib at the start of PATH and LIB. You have not shared the information asked in new bug template. Please share below info to comment further:

- Operating System Name:
- db2level output from clidriver if in use:
- Target Db2 Server Version:
- node.js Version:
- ibm_db version:
- Value of below environment variables if set:
  IBM_DB_HOME:
  PATH:
  LIB:

I am interested to know, are you using system environment variable IBM_DB_HOME or not? If yes, what is the value? If no, then what is the path of ibm_db install directory? You need to add ibm_db\installer\clidriver\lib;ibm_db\installer\clidriver\lib\icc; to PATH and LIB so that ibm_db could pick up the right gskit library at runtime. Thanks.

giselle-says commented 1 year ago

@bimalkjha below the information.

GSK8 Path: C:\Program Files\ibm\gsk8\lib64 & C:\Program Files\IBM\GSK8\bin Lib: no variable

I added ibm_db\installer\clidriver\lib & ibm_db\installer\clidriver\lib\icc; in PATH & LIB.

Thanks,

bimalkjha commented 1 year ago

@GiselleArroyo Rename the directory C:\Program Files\ibm\gsk8 to C:\Program Files\ibm\gsk8-old and then run node test program from new command prompt. Please share result of your test program including any change in connection string. If still getting error, then we need db2traces for investigation. Thanks.

giselle-says commented 1 year ago

Hi @bimalkjha string connection : var connString = "DRIVER={DB2};DATABASE=bigsql;UID=uid;PWD=pwd;HOSTNAME=bigsql-ibm.com;port=port;PROTOCOL=TCPIP;Security=SSL;SSLServerCertificate=C:\\Users\\Documents\\GitHub\\spud\\bigsql-ssl.arm;";

I got the same error. image

I turned traces on and run db2trc info image

bimalkjha commented 1 year ago

@GiselleArroyo Please find ibm_db\installer\testODBCConnection.bat file and open it in an editor. You can see "db2cli validate" command in this script at line number 16. Replace this validate command with below two commands:

db2cli writecfg add -dsn ssldsn -database bigsql -host big-sql.ibm.com -port 50001 -parameters "SecurityTransportMode=SSL;SSLServerCertificate=C:\\Users\\Documents\\GitHub\\spud\\bigsql-ssl.arm;"
db2cli validate -dsn ssldsn -connect -user dbuser -passwd dbpass

Update the database connection info in above two commands and save this file. Now, open Administrator command prompt, cd to ibm_db\installer directory and execute the testODBCConnection.bat file. Save the output of this script file in a text file. The script should do the connection testing and generate few 1. files which are db2 trace files. Please zip all 1. files along with output of testODBCConnection.bat file and share here for investigation. Thanks.

giselle-says commented 1 year ago

Hi @bimalkjha

Zip folder attached, I got the same error:

[FAILED]: [IBM][CLI Driver] SQL1109N The command was not processed because the database manager failed to load the following DLL: "GSKit Error: 2". SQLSTATE=42724

Thanks for your help, trace.zip

bimalkjha commented 1 year ago

@GiselleArroyo In previous post, you mentioned that you have updated PATH and LIB environment variable to add ....\ibm_db\installer\clidirver\bin;....\ibm_db\installer\clidriver\lib at start, but from output of db2cli validate command, we do not see it effective. Still the db2 lib from C:\Program Files\IBM\SQLLIB is getting used. Probably you have set IBM_DB_HOME env var pointing to SQLLIB and testODBCConnection.bat picked up the value of IBM_DB_HOME.

I checked the trace files and found below error in 1.fmt file:

15020   data DB2 UDB common communication sqlccCreateDefaultKeyDB fnc (3.3.43.290.0.275)
    pid 93560 tid 17976 cpid -1 node 0 sec 36 nsec 532619200 probe 275
    bytes 678

    Data1   (PD_TYPE_DIAG_LOG_REC,670) Diagnostic log record:

    2023-03-08-09.25.22.477000-360 I58667F668           LEVEL: Error
    PID     : 93560                TID : 17976          PROC : db2cli.exe
    INSTANCE: DB2                  NODE : 000
    HOSTNAME: IBM-PF36L9TH
    EDUID   : 17976
    FUNCTION: DB2 UDB, common communication, sqlccCreateDefaultKeyDB, probe:275
    MESSAGE : ZRC=0x00000002=2
              SQL0002N  The bind file name is not valid.

              DIA8002C A deadlock has occurred, rolling back transaction.
    DATA #1 : <preformatted>
    GSKKM_StoreCACert: GSKit Error = 2,
    KeyDB = ,
    EncPassLen = 32, PwdLen = 1024, DefaultKeyDBUsed = 1,
    ServerCert = C:\\Users\\000623781\\Documents\\GitHub\\spud\\server\\db\\bigsql-ssl.arm.

This error is coming from GSKit library and to pursue further investigation, you need to open IBM Support ticket. IBM Security team need to look into the issue.

We also found that you have installed IBM Data Server Client as C:\PROGRAM Files\IBM\SQLLIB in your system and it is getting used by ibm_db and not the ibm_db\installer\clidriver. You have also installed IBM Data Server Driver Package as C:\Program Files\IBM\IBM DATA SERVER DRIVER.

So, you have three types of db2 clients installed in your system. DSClient, DSDriver and clidriver. Which one you want to use with ibm_db?

If you want to use DSClient which is C:\Program Files\IBM\SQLLIB then you can create keystoredb using gskit command line, add servercertificate to keystoredb and use the SSLKeyStoreDB, SSLKeyStorePassword in the connection string instead of SSLServerCertificate.

If you want to avoid use of DSClient as it is causing GSKit error, you can try using clidriver that comes with ibm_db. For that you need to run below commands and set env vars:

set IBM_DB_HOME=
npm uninstall ibm_db
npm install ibm_db
set PATH=.....\ibm_db\installer\clidirver\bin;....\ibm_db\installer\clidriver\lib;%PATH%
set LIB=.....\ibm_db\installer\clidirver\bin;....\ibm_db\installer\clidriver\lib;%LIB%
db2level
db2cli validate
node test.js

Check the output of db2cli validate command to see from where clidriver is getting used. Output of db2level command will also tell you that. In PATH and LIB, replace ..... with full path of ibm_db as you have yet not shared that which path ibm_db is getting installed. Thanks.

bimalkjha commented 1 year ago

@GiselleArroyo Please share update about the issue. Thanks.

giselle-says commented 1 year ago

Hello @bimalkjha,

I installed ibm_db again but clidriver seems like was not installed inside node_modules\ibm_db\installer\, do you know why I´m not able to see the folder again? I was trying to set the PATH & LIB but need clidriver folder.

Thanks for your help.

bimalkjha commented 1 year ago

@GiselleArroyo If you have set environment variable IBM_DB_HOME then clidriver will not get downloaded. I think you have set IBM_DB_HOME=C:\Program Files\IBM\SQLLIB somewhere. We can get clarity about it by looking on the output of npm install ibm_db command or cd to ibm_db folder and run npm install. I would again suggest to run below commands in sequence from windows command line and share the complete output of these commands:

set IBM_DB_HOME=
npm uninstall ibm_db
npm install ibm_db
set PATH=.....\ibm_db\installer\clidirver\bin;....\ibm_db\installer\clidriver\lib;%PATH%
set LIB=.....\ibm_db\installer\clidirver\bin;....\ibm_db\installer\clidriver\lib;%LIB%
db2level
db2cli validate
node test.js

Thanks.

giselle-says commented 1 year ago

@bimalkjha I ran the following commands:

set IBM_DB_HOME=C:\clidriver 
yarn uninstall ibm_db
yarn install ibm_db

yarn install inside ibm_db folder and I got this error:

warning ..\..\..\package.json: No license field
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...

success Saved lockfile.
$ node installer/driverInstall.js
platform = win32, arch = x64, node.js version = v16.14.0
IBM_DB_HOME environment variable have already set to -> C:\clidriver

Downloading of clidriver skipped - build is in progress...

C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure build  --IS_DOWNLOADED=false --IBM_DB_HOME=$IBM_DB_HOME )  else (node "" configure build  --IS_DOWNLOADED=false --IBM_DB_HOME=$IBM_DB_HOME )

Error: Command failed: node-gyp configure build  --IS_DOWNLOADED=false --IBM_DB_HOME=$IBM_DB_HOME
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@16.14.0 | win32 | x64
gyp info find Python using Python version 3.11.2 found at "C:\Program Files\Python311\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16  
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14  
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16 
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:406:5)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build" "--IS_DOWNLOADED=false" "--IBM_DB_HOME=$IBM_DB_HOME"
gyp ERR! cwd C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok

    at ChildProcess.exithandler (node:child_process:399:12)
    at ChildProcess.emit (node:events:520:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'node-gyp configure build  --IS_DOWNLOADED=false --IBM_DB_HOME=$IBM_DB_HOME'
}

node-gyp build process failed!

Proceeding with Pre-compiled Binary Installation.

===================================
ibm_db installed successfully.
===================================

Done in 7.48s.

I checked python and msvs version (yarn config list)


msvs_version: '2017',
python: 'C:Python27python.
```exe'

I already have installed **Desktop development with C++**

Thanks,
giselle-says commented 1 year ago

What I tried to do is running yarn add windows-build-tools in PowerShell but windows-build-tools is taking many time installing, it´s been like 3 hours and still running.

image

I´ll restarted my computer and try again.

bimalkjha commented 1 year ago

@GiselleArroyo Why are you setting IBM_DB_HOME to C:\clidriver? In my previous updates, I mentioned to clean setting of IBM_DB_HOME, then only you can have ibm_db\installer\clidriver. Since, you have set IBM_DB_HOME, ibm_db is not downloading clidriver. Please make sure this clidriver is same as https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ntx64_odbc_cli.zip. clidriver downloaded from Fix Central or passport advantage will not work, you need dsdriver or data server client. Since, build from source code has failed, ibm_db proceeded with precompiled binary and installation has completed successfully. So, you should have bindings file as C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\build\Release\odbc_bindings.node and you should be able to use ibm_db now. Your test program should work. If not, please share contents of C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\build\Release and C:\clidriver directories. Also, instead of yarn, use npm. Thanks.

giselle-says commented 1 year ago

@bimalkjha sorry for the misunderstanding.

Thanks for share the clidriver link.

Output:

C:\Users\000623781\Documents\GitHub\spud\server>set IBM_DB_HOME=

C:\Users\000623781\Documents\GitHub\spud\server>npm uninstall ibm_db

up to date, audited 194 packages in 599ms

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

found 0 vulnerabilities

C:\Users\000623781\Documents\GitHub\spud\server>npm install ibm_db

added 53 packages, and audited 247 packages in 33s

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

found 0 vulnerabilities

C:\Users\000623781\Documents\GitHub\spud\server>set PATH=C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\installer\clidriver\bin;C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\installer\clidriver\lib;%PATH%

C:\Users\000623781\Documents\GitHub\spud\server>set LIB=C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\installer\clidriver\bin;C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\installer\clidriver\lib;%LIB%

C:\Users\000623781\Documents\GitHub\spud\server>db2level
DB21085I  This instance or install (instance name, where applicable: "*") uses
"64" bits and DB2 code release "SQL11058" with level identifier "0609010F".
Informational tokens are "DB2 v11.5.8000.3209", "special_26260",
"DYN2301190517WIN64_26260", and Fix Pack "0".
Product is installed at
"C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\installer\
clidriver" with DB2 Copy Name "IBM Data Server Driver For ODBC and CLI".

C:\Users\000623781\Documents\GitHub\spud\server>db2cli validate

===============================================================================
Client information for the current copy (copy name: C_Users_000623781_Documents_GitHub_spud_server_node_modules_ibm_db_installer_clidriver):
===============================================================================

Client Package Type       : IBM Data Server Driver For ODBC and CLI
Client Version (level/bit): DB2 v11.5.8000.3209 (special_26260/64-bit)
Client Platform           : NT 64BIT
Install/Instance Path     : C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\installer\clidriver

Common App Data Path      : C:\ProgramData\IBM\DB2\C_Users_000623781_Documents_GitHub_spud_server_node_modules_ibm_db_installer_clidriver
DB2DSDRIVER_CFG_PATH value: <not-set>
db2dsdriver.cfg Path      : <Common App Data Path>\cfg\db2dsdriver.cfg
DB2CLIINIPATH value       : <not-set>
db2cli.ini Path           : <Common App Data Path>\cfg\db2cli.ini
db2diag.log Path          : <Common App Data Path>\db2diag.log

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

Copyname                                                                                  Version Package Language Installed-Location
-------------------------------------------------------------------------------
C_Users_000623781_Documents_GitHub_spud_server_node_modules_ibm_db_installer_clidriver[C] 11.5.0800 CLI     EN       C:\Users\000623781\Documents\GitHub\spud\server\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_000623781_Documents_GitHub_spud_server_node_modules_ibm_db_installer_clidriver\cfg\db2dsdriver.cfg".

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

C:\Users\000623781\Documents\GitHub\spud\server\db>node db2.js
[Error: [IBM][CLI Driver] SQL1109N  The command was not processed because the database manager failed to load the following DLL: "GSKit Error: 2".  SQLSTATE=42724
] {
  error: '[ibm_db] SQL_ERROR',
  sqlcode: -1109,
  state: '42724'
}

Release

C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\build\Release>dir
 Volume in drive C is Windows
 Volume Serial Number is 60AE-0156

 Directory of C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\build\Release

03/16/2023  12:29 AM    <DIR>          .
03/16/2023  12:54 AM    <DIR>          ..
03/16/2023  12:29 AM    <DIR>          obj
03/16/2023  12:29 AM             1,013 odbc_bindings.exp
03/16/2023  12:29 AM         1,628,015 odbc_bindings.iobj
03/16/2023  12:29 AM           366,016 odbc_bindings.ipdb
03/16/2023  12:29 AM             2,138 odbc_bindings.lib
03/16/2023  12:29 AM           300,544 odbc_bindings.node
03/16/2023  12:29 AM         5,165,056 odbc_bindings.pdb
               6 File(s)      7,462,782 bytes
               3 Dir(s)  157,682,184,192 bytes free

clidriver

C:\clidriver>dir
 Volume in drive C is Windows
 Volume Serial Number is 60AE-0156

 Directory of C:\clidriver

03/16/2023  12:04 AM    <DIR>          .
03/16/2023  12:04 AM    <DIR>          bin
03/16/2023  12:04 AM    <DIR>          bnd
03/16/2023  12:04 AM    <DIR>          cfg
03/16/2023  12:04 AM    <DIR>          conv
03/16/2023  12:04 AM    <DIR>          db2
01/26/2023  05:29 AM    <DIR>          db2dump
03/16/2023  12:04 AM    <DIR>          include
03/16/2023  12:04 AM    <DIR>          lib
03/16/2023  12:04 AM    <DIR>          license
03/16/2023  12:04 AM    <DIR>          msg
03/16/2023  12:04 AM    <DIR>          properties
03/16/2023  12:04 AM    <DIR>          security
               0 File(s)              0 bytes
              13 Dir(s)  157,703,364,608 bytes free

Thanks!

bimalkjha commented 1 year ago

@GiselleArroyo Please run testODBCConnect.bat script now and share the generated 1.* files. In the output, you can see, C:\Users\000623781\Documents\GitHub\spud\server\node_modules\ibm_db\installer\clidriver is getting used or not. Thanks.

bimalkjha commented 1 year ago

Also, you can restore C:\Program Files\ibm\gsk8 directory and run below commands from Windows Command Prompt:

set PATH=C:\Program Files\ibm\gsk8\bin;%PATH%
cd C:\Users\000623781\Documents\GitHub\spud\server\db
gsk8capicmd_64 -keydb -create -db "C:\Users\000623781\Documents\GitHub\spud\server\db\client.kdb" -pw "clientpass " -stash -populate
# Add self-singed SSL Certificate received from server to client kdb.
gsk8capicmd_64 -cert -add -db client.kdb -pw clientpass -label "myservercert" -file bigsql-ssl.arm -format ascii -fips
gsk8capicmd_64 -cert -list -db client.kdb -pw "clientpass"

You can use -pw and -label of your choice. Now, use below connection string in your node.js test program and run it. var connString = "DATABASE=dbname;UID=dbuser;PWD=dbpass;HOSTNAME=myhost.ibm.com;port=443;PROTOCOL=TCPIP;Security=SSL;SSLClientKeystoredb=C:\Users\000623781\Documents\GitHub\spud\server\db\client.kdb;SSLClientKeystash=C:\Users\000623781\Documents\GitHub\spud\server\db\client.sth"; Thanks.

giselle-says commented 1 year ago

I´m presenting an error trying to create the .sth file, I´m looking how to solve it. (I restore gsk8 folder )

What I found to solve the error is uninstalling & installing gsk8 again but did not work. (https://www.ibm.com/support/pages/gskit-v8-install-uninstall-and-upgrade-instructions-windows-systems) gsk8

I´m looking for a solution :).

Weeks ago, I created .kdb & .sth file, I used those files and I got this error,:

[Error: [IBM][CLI Driver] SQL30081N  A communication error has been detected. Communication protocol being used: "SSL".  Communication API being used: "SOCKETS".  Location where the error was detected: "".  Communication function detecting the error: "sqlccSSLSocketSetup".  Protocol specific error code(s): "414", "*", "*".  SQLSTATE=08001
] {
  error: '[ibm_db] SQL_ERROR',
  sqlcode: -30081,
  state: '08001'
}
bimalkjha commented 1 year ago

@GiselleArroyo File capicmd_res.dll should be inside C:\Program Files\ibm\gsk8\lib directory. If not, then probably your gsk8 dir got corrupted. On my windows too, I see sometimes few files get deleted automatically. I am puzzled about this behavior of windows. If file is missing, then I would suggest to download latest version of GSKit from IBM site and install it. Using the latest GSKit may fix connection problem too. Thanks.

giselle-says commented 1 year ago

@bimalkjha

I´m able to connect to bigsql :)

I really appreciate your help.

bimalkjha commented 1 year ago

The error SQL10013N The specified library "GSKit Error: 2" could not be loaded. for second connection is due to newer version of GSKit library getting shipped with db2 client v 11.5.5.0 onwards. We have repro steps with detail explanation in similar issue https://github.com/ibmdb/go_ibm_db/issues/207. Work around of this issue is to either install GSKit in the system and create keystoredb, add certificates and then use it or use the older version of clidriver from https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/v11.5.4/ Thanks.