Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PGto DB2 - Mailing list pgsql-general

From karthik kumar
Subject Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PGto DB2
Date
Msg-id CADbTQ2aQqUC_mUJ9MkdiK0MHjXcj7AjEmuMFhP0ykEinj8aRqg@mail.gmail.com
Whole thread Raw
In response to Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PGto DB2  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PGto DB2
Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PGto DB2
List pgsql-general
This is the error we see in the ODBC trace log

ODBC][586][1523477070.240690][__handles.c][450]
        Exit:[SQL_SUCCESS]
            Environment = 0x556f874716a0
[ODBC][586][1523477070.240741][SQLSetEnvAttr.c][182]
        Entry:
            Environment = 0x556f874716a0
            Attribute = SQL_ATTR_ODBC_VERSION
            Value = 0x3
            StrLen = 0
[ODBC][586][1523477070.240762][SQLSetEnvAttr.c][349]
        Exit:[SQL_SUCCESS]
[ODBC][586][1523477070.240779][SQLAllocHandle.c][364]
        Entry:
            Handle Type = 2
            Input Handle = 0x556f874716a0
[ODBC][586][1523477070.240804][SQLAllocHandle.c][482]
        Exit:[SQL_SUCCESS]
            Output Handle = 0x556f874f2000
[ODBC][586][1523477070.240837][SQLDriverConnect.c][687]
        Entry:
            Connection = 0x556f874f2000
            Window Hdl = (nil)
            Str In = [database=SAMPLE;DRIVER=SAMPLE;UID=db2inst1;PWD=********][length = 55 (SQL_NTS)]
            Str Out = 0x7ffd31cf8b60
            Str Out Max = 1024
            Str Out Ptr = 0x7ffd31cf8b3c
            Completion = 1
        UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'

        DIAG [08001] [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: "::1".  Communication function detecting the error: "connect".  Protocol specific error code(s): "99", "*", "*".  SQLSTATE=08001


[ODBC][586][1523477070.331477][SQLDriverConnect.c][1273]
        Exit:[SQL_ERROR]

The trouble is, we are not convinced of the root cause, as using isql we can connect to db2 using the same account.

Env details

Db2 server on a docker container on my laptop: IP address 172.17.0.4
Db2 client where postgres server is installed is on a different container.  IP address: 172.17.0.3

Output of db2 list node directory

Node 2 entry:

 Node name                      = MYDB3
 Comment                        =
 Directory entry type           = LOCAL
 Protocol                       = TCPIP
 Hostname                       = 172.17.0.4
 Service name                   = 50000

output of db2 list db directory

Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Node name                            = MYDB3
 Database release level               = 14.00
 Comment                              =
 Directory entry type                 = Remote
 Catalog database partition number    = -1
 Alternate server hostname            =
 Alternate server port number         =

$ cat /etc/odbc.ini
[SAMPLE]
Description = DB2 remote SAMPLE Database
Driver = SAMPLE
servername = 172.17.0.4
system = MYDB3
username = db2inst1
password = db2inst1
port = 50000
PROTOCOL=TCPIP
Debug = 1
Commlog = 1

$ cat /etc/odbcinst.ini
[SAMPLE]
Instance       =  MYDB3
Description     = DB2 ODBC Driver
Driver          = /home/db2inst1/sqllib/lib64/libdb2.so
CommLog         = 1
FileUsage       = 1
#DontDLClose    = 1

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Archiving Data to Another DB?
Next
From: Steven Hirsch
Date:
Subject: Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PGto DB2