Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6OE2-0004H8-3r for pgsql-general@arkaria.postgresql.org; Wed, 11 Apr 2018 22:28:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f6ODz-0004P9-SO for pgsql-general@arkaria.postgresql.org; Wed, 11 Apr 2018 22:28:19 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6ODy-0004Oz-K4 for pgsql-general@lists.postgresql.org; Wed, 11 Apr 2018 22:28:19 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6ODv-0004hT-BF for pgsql-general@postgresql.org; Wed, 11 Apr 2018 22:28:17 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6D8C120AC5; Wed, 11 Apr 2018 18:28:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 11 Apr 2018 18:28:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=yy5aq/yiTKvjePyu/AfqIu/2fJB3a 2SGFyKZn15+biA=; b=E/4gLpoTPe3Hd4SfZdC9MUZuxkqaINJEE23TvhYpzq6vK cj4i+V7IU39sqkKSSKA0AnNHvWurNWaY89eI1y+0BJa12231s+K/0rimSh+Y1Uu/ 4u7RPNiu9Xg7WJeBV8wv8CQMFWKY3HvUChcDAWBOYlnpo3sy5gZyCnrcm9TQXxwB qJY37CErlA3gEOZtZmOIwmxyhFiYef/hxKLfFhyYI3alz7HHH7JpGoijll/kJG+H zf6SWlmWSgXxzYaI3hwm1ymWReWvBQXYSQYCIVavVkcm7fz02bU9bJd69dzNgMds l3AH1TcA/OAGY+FZXpMq8y5YW2upGyMfXh5yPMNzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=yy5aq/ yiTKvjePyu/AfqIu/2fJB3a2SGFyKZn15+biA=; b=kvgiBQBmEoZMXI+jrYYxWp y8pncCpAEPDAn8fZSs/7yCcDoRk0ZRwfHUezFSHv6/NuFYr9hwPZLJsu7BTvnnpw Glj8oJX593nqAiMkRhyXMRph7UqeOQ2Kdfpg+KnhZe16QaXoOiDDCLa1ORUHTLhe OkMta8c/BdHQWW1HIodTmQQzFz8lca6P8B5x5V/6nYhmU7JX0p1g1/B4OCYfg5Fn BhcmEZZjQL0HPQJpWt9KpbXGcWjp8NahK9SnOVf36Sc5MV+0aJthmfIU8r9rVY8K BfEPvIpmEl6WTEFH4MKLHVKlYtk+AW2EXdxD4aPe3hKeNWwkwfX7z9NwZD26tKuQ == X-ME-Sender: Received: from [192.168.1.2] (71-35-123-124.tukw.qwest.net [71.35.123.124]) by mail.messagingengine.com (Postfix) with ESMTPA id A07E9E508F; Wed, 11 Apr 2018 18:28:13 -0400 (EDT) Subject: Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PG to DB2 To: karthik kumar Cc: pgsql-general@postgresql.org References: <2aef0ab7-8854-978a-aae0-7e3cf6214c79@aklaver.com> <2f510eb0-86d7-b2fa-1397-5d16512c1234@aklaver.com> From: Adrian Klaver Message-ID: <0d701396-0cbd-1a83-619e-ca83b50410eb@aklaver.com> Date: Wed, 11 Apr 2018 15:28:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/11/2018 01:20 PM, karthik kumar wrote: > 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 Protocol specific error code(s): "99": https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.5.0/com.ibm.db2.luw.messages.doc/doc/r0052008.html#r0052008.dita__tcpcec EADDRNOTAVAIL 99 The specified hostname or IP address is not available from the local machine. Looks to me like it is not finding your server IP and is trying IPv6 localhost with port 5000 and not finding it. More comments below. > > > [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         = > So you changed settings below. What happened to UID AND PWD? Also I would simplify and get rid of in odbc.ini: system PROTOCOL and in odbcinst.ini: Instance Also in odbcinst.init I would rename the section header from SAMPLE to DB2 and Driver in odbc.ini to DB2 Helps with identifying what you are actually using. Did you also change the FOREIGN SERVER/USER MAPPING settings and if so to what? > $ 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 > -- Adrian Klaver adrian.klaver@aklaver.com