ibm_db for nodejs: using TCP/IP works fine but using SSL reports SQL30081N A communication error "selectForConnectTimeout" - node.js

In a Node app with ibm_db, I am trying to connect to Db2 Warehouse on Cloud using ssl connection string.
On CentOS 7.8, using SSL connection string as below works fine.
var connStr = "DATABASE=BLUDB;HOSTNAME=dashdb-xxxxxxxxxxxx.xxxxx.xxx.bluemix.net;PORT=50001;PROTOCOL=TCPIP;UID=XXXXXXXXX;PWD=XXXXXXXXXXX;Security=SSL"
However, on RHEL 7.2, using SSL connection string does not work, SQL30081N is reported. It is same source code working on CentOS 7.8.
[IBM][CLI Driver] SQL30081N A communication error has been detected.
Communication protocol being used: "TCP/IP".
Communication API being used: "SOCKETS".
Location where the error was detected: "XXX.XX.XXX.XXX".
Communication function detecting the error: "selectForConnectTimeout".
Protocol specific error code(s): "115", "*", "*". SQLSTATE=08001\n
As a test, changing SSL connection string to TCP/IP connection string as below, it works on RHEL 7.2.
var connStr = "DATABASE=BLUDB;HOSTNAME=dashdb-xxxxxxxxxxxx.xxxxx.xxx.bluemix.net;UID=XXXXXXXXX;PWD=XXXXXXXXXXX;PORT=50000;PROTOCOL=TCPIP";
On each environment, installed the latest IBM ODBC and CLI Driver via npm install ibm_db.
I think the certificate file for ssl connection is bundled with the driver package and will be used for connections, so ssl configuration does not required manually.
Or, would I need to configure anything else for using SSL on RHEL 7.2 ?

Related

Just installed mongodb cant connect to server on Ubuntu 22.04

I just completed an installation of mongodb in my computer and, after starting and enabling it I keep getting the same error:
MongoDB shell version v4.2.23
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2022-11-10T16:25:32.787+0100 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:353:17
#(connect):2:6
2022-11-10T16:25:32.788+0100 F - [main] exception: connect failed
2022-11-10T16:25:32.788+0100 E - [main] exiting with code 1
I uninstalled and installed multiple times and tried solutions that worked for other people in similar posts but I can not make it work.
I have a feeling it have something to do with the port it is looking for (27017) but I do not know how to check if that is the problem and, if so, how to fix it.
Thanks!
Here are a few things to consider:
Check if the MongoDB process is running (you can verify using ps, netstat (check listen port) command in the server.
See if your MongoDB service runs locally. That is because by default, the listen address of MongoDB is localhost/loopback.
Check if the firewall is running and you have allowed the port.
Verify if you are able to use telnet to command the port 27017 from the application server.

Error in connecting python client "Exception during establishing a SSL connection: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record"

I am trying to get a python ElasticSearch client to connect to a local OpenSearch server that is running via docker. Am unable to connect and keep getting
opensearch-node1 | [2021-09-25T00:09:09,526][ERROR][o.o.s.s.h.n.SecuritySSLNettyHttpServerTransport] [opensearch-node1] Exception during establishing a SSL connection: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record:
Installed OpenSearch locally sing docker following these instructions https://opensearch.org/downloads.html
Tried various ways to get the python client to connect but all are failing.
# es = Elasticsearch(timeout=600, hosts="http://localhost:9200", http_auth=('admin', 'admin'), use_ssl=False, verify_certs=False)
es = Elasticsearch(timeout=600, hosts=["http://localhost:9200"])
es.ping()
python version: 3.9.7
ElasticSearch python lib: 7.15.0
Has anybody experiences this?
**** Figured it out ****
Need to have a client of at most 7.13.4 as per the docs opensearch.org/docs/clients/index
and as per this issues github.com/opendistro-for-elasticsearch/sample-code/issues/242, have to initiate the client like this for local dev
es = Elasticsearch(['https://admin:admin#localhost:9200/'],
use_ssl=False,
verify_certs=False,
ssl_show_warn=False)

Can I see the connection string in DBeaver and copy it to make a connection to DB2 in Python? [duplicate]

I have a running DBeaver connection to a DB2 database and now I would like to connect also in Python with the DB2 database securely over SSL. As authenticating I would like to use my windows account instead of giving a PW and UserID, to do so in DBeaver I changed:
javax.net.ssl.keyStoreType = Windows-ROOT
javax.net.ssl.trustStoreType = Windows-MY
Is this also possible with the Python connection?
I tried the following to set up the connection:
import ibm_db
connID = ibm_db.connect('DRIVER={IBM DB2 ODBC DRIVER};'
'DATABASE=XXXX;'
'HOSTNAME=XXXXYYY.net;'
'PORT=9797;'
'PROTOCOL=TCPIP;'
'SECURITY=ssl;'
'SSLSERVERCERTIFICATE=C:/Users/..../cert.cer;'
, '', '')
if connID is None:
print("\nERROR: Unable to connect.")
exit(-1)
print("Connected!")
I get the following error:
SQLCODE=-30082][CLI Driver] SQL30082N Security processing failed with reason "17" ("UNSUPPORTED FUNCTION"). SQLSTATE=08001
Some details:
M:\>"C:\Users\.conda\pkgs\ibm_db-3.0.1-py37hfa6e2cd_1\Lib\site-packages\clidriver\bin\db2level.exe"
DB21085I This instance or install (instance name, where applicable: "*") uses
"64" bits and DB2 code release "SQL11013" with level identifier "0204010F".
Informational tokens are "DB2 v11.1.3031.295", "s1804271300",
"DYN1804271300WIN64", and Fix Pack "3a".
Product is installed at
"C:\Users\.conda\pkgs\ibm_db-3.0.1-py37hfa6e2cd_1\Lib\site-packages\cli
driver" with DB2 Copy Name "IBM Data Server Driver For ODBC and CLI".
I'm using:
Python version 2.7.17
Ibm_db version 3.0.1

Error while making connection on oracle sql developer using linux OS

I am trying to make a new connection on oracle sqldeveloper as sysdba and when i hit test or connect i got this error message:
Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection
The default port is 1521, but 1522 is often common.
Check if the database is up. database will not be up causing this issue.
or Check if you are able to connect using sqlplus

Using Firefox on Mac to launch Analytics for Apache Hadoop and receive Secure Connection Failed

Using Firefox on Mac to launch Analytics for Apache Hadoop and receive Secure Connection Failed: An error occurred during a connection to bi-hadoop-prod-2215.services.dal.bluemix.net:9443

Resources