ibmdb / node-ibm_db

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

Certificate issue still persists #898

Closed Sridharv-ec closed 1 year ago

Sridharv-ec commented 1 year ago

Hi @bimalkjha, I have followed your instructions mentioned in the below git link https://github.com/ibmdb/node-ibm_db/issues/762

I have got the DB2 certificates from the environment team in the .arm , .pem and .crt extensions. Checked with environment team and asked from where they got these certificates. They mentioned that they got it form DB2 server.

I have tried with all extensions(.arm, .pem and .crt) but still I am getting the same below error

[0-0] [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

Please find the code I am using

 var connStr = 'DRIVER={DB2};DATABASE=MYDB;HOSTNAME=MYHOST;PORT=MYPOST;Security=SSL;SSLServerCertificate=C:/Lloyds/OB/GHE1/aisp-e2e-bdd/test/certificates/db2/sca-jenkins-slave-appduv327a-DGSCATST.pem;PROTOCOL=TCPIP;UID=DGSCATST;PWD=MYPASSWORD;';

try { var option = { connectTimeout : 40, systemNaming : true };// Connection Timeout after 40 seconds. var conn = ibmdb.openSync(connStr, option); conn.query("SELECT * FROM MyTable WHERE ATH_MCN_SEN_ID = 'd1992c73-9e6a-4367-9885-a5cd176e5519'", function (err, rows) { if (err) { console.log(err); } else { console.log(rows); } conn.close(); }); } catch (e) { console.log(e.message); }

Sridharv-ec commented 1 year ago

I am getting below error as well

[0-0] [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): "420", "", "". SQLSTATE=08001 [0-0] ] { [0-0] error: '[ibm_db] SQL_ERROR', [0-0] sqlcode: -30081, [0-0] state: '08001' [0-0] }

bimalkjha commented 1 year ago

@Sridharv-ec First, you have not provided any info as mentioned in the new issue template. We don't know the Operating System name of client, db2level info for server and client, etc. It makes us difficult to comment as instructions are operating system dependent. Please provide all info. Now, GSKit error 420 means GSK_ERROR_SOCKET_CLOSED. i.e. The connection socket is closed. It may be due to previous error or invalid port number is used in the connection string. Now, coming to your previous error 414, it is due to bad certificate file. The certificate file can get corrupted during transfer from one system to another. Please check the size of the certificate file on the Db2 server system and in your system should be same. The files must be transferred in binary mode. If text mode selected, then the format of file changes and hence error. You also check the permission of the file in your local system. The user should have read permission for the full path and there should not be any issue in reading the certificate file by the application.

If everything looks ok and you still see error, then you need to collect db2trace for the repro program. The instructions to collect trace can be shared once you post all info required by new issue including db2level output and path of the directory where you have installed ibm_db. Thanks.

bimalkjha commented 1 year ago

Also share the name of your database. Is it DASHDB or BLUDB or some Db2 instance from IBM Cloud or local installation of Db2 server?