From: Adrian Klaver <adrian.klaver@aklaver.com>
To: karthik kumar <karthikkumar.db2dba@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PG to DB2
Date: Wed, 11 Apr 2018 15:28:12 -0700
Message-ID: <0d701396-0cbd-1a83-619e-ca83b50410eb@aklaver.com> (raw)
In-Reply-To: <CADbTQ2aQqUC_mUJ9MkdiK0MHjXcj7AjEmuMFhP0ykEinj8aRqg@mail.gmail.com>
References: <CADbTQ2a9Y4-3dQCOq7BG8juf2cyZvm7tAhW_XTpdJv1n5c-QPA@mail.gmail.com>
<2aef0ab7-8854-978a-aae0-7e3cf6214c79@aklaver.com>
<CADbTQ2aKKrbGYH9p32+hx+=SYrXY_Q84JhfOqUzuRWaOZ260Gw@mail.gmail.com>
<a175dc17-9737-58c8-5819-f99a6c43a47c@aklaver.com>
<CADbTQ2bYPqKaxFu78MNSufYSRSAkEksBifRJ_iCUnjRCBT9jVA@mail.gmail.com>
<2f510eb0-86d7-b2fa-1397-5d16512c1234@aklaver.com>
<CADbTQ2ZZ0POqB4ZMzV2UV5ikDNoB=Jo3V27fzQeQyNGwxd7cvw@mail.gmail.com>
<CADbTQ2bypc9LwyVQ4hN0ykO0PGsEbaMeyVnB4eYyH-huOxXHNA@mail.gmail.com>
<c7fef832-7332-cf8e-20dd-10c40052fac6@aklaver.com>
<CADbTQ2aQqUC_mUJ9MkdiK0MHjXcj7AjEmuMFhP0ykEinj8aRqg@mail.gmail.com>
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/r005200...
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, karthikkumar.db2dba@gmail.com
Subject: Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PG to DB2
In-Reply-To: <0d701396-0cbd-1a83-619e-ca83b50410eb@aklaver.com>
References: <CADbTQ2a9Y4-3dQCOq7BG8juf2cyZvm7tAhW_XTpdJv1n5c-QPA@mail.gmail.com> <2aef0ab7-8854-978a-aae0-7e3cf6214c79@aklaver.com> <CADbTQ2aKKrbGYH9p32+hx+=SYrXY_Q84JhfOqUzuRWaOZ260Gw@mail.gmail.com> <a175dc17-9737-58c8-5819-f99a6c43a47c@aklaver.com> <CADbTQ2bYPqKaxFu78MNSufYSRSAkEksBifRJ_iCUnjRCBT9jVA@mail.gmail.com> <2f510eb0-86d7-b2fa-1397-5d16512c1234@aklaver.com> <CADbTQ2ZZ0POqB4ZMzV2UV5ikDNoB=Jo3V27fzQeQyNGwxd7cvw@mail.gmail.com> <CADbTQ2bypc9LwyVQ4hN0ykO0PGsEbaMeyVnB4eYyH-huOxXHNA@mail.gmail.com> <c7fef832-7332-cf8e-20dd-10c40052fac6@aklaver.com> <CADbTQ2aQqUC_mUJ9MkdiK0MHjXcj7AjEmuMFhP0ykEinj8aRqg@mail.gmail.com> <0d701396-0cbd-1a83-619e-ca83b50410eb@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox