Db2

 View Only
  • 1.  DB2 connect command hangs/does not complete

    Posted 14 days ago

    Hello,

    I have a long standing issue where I am trying to connect to Db2 for IBM i Series from an Ubuntu environment with Db2 Runtime Client with Db2 Connect license.

    I have cataloged two Db2 servers: LUW and IBM i Series.

    I have no issues connecting to the LUW server; however, when I execute the `connect` command for IBM i, the command does not complete and indefinitely hangs (this will stay incomplete as-is without returning error codes).

    I have reached out to the network guys on the server side, and they said they see the packets of initiating connection and the server has acknowledged and sent packets back.  But it seems like db2 client just indefinitely hangs without completing the command. 

    I have tried ping/telnet to the server IP:port, and they all seem to work fine. I have checked for firewalld service, and this comes out dud as well. 

    What could possibly cause the client to not complete the command? 



    ------------------------------
    Howard Kim
    ------------------------------


  • 2.  RE: DB2 connect command hangs/does not complete

    Posted 9 days ago


    That should be a simple problem to fix.

    Do you have more than one version/fixpack of a Db2-product on the ubuntu system?  Carefully check your PATH and LD_LIBRARY_PATH values.

    Are you using the db2 clp or other odbc tool, or isql etc, in order to test the connection to i-series? 

    Otherwise, specify the `db2level` output for your runtime client, and make sure it is the current release and latest fixpack.


    You can also use the `db2trc` facility to observe the connection attempt at low level, and then use the same tool to format the binary tracefile into text that you/others can study.  Lookup `db2cli` in the Db2-LUW knowledge centre for more details. See below for sample sequence.


    If you are using a recent version of the Db2-runtime-client (i.e version 11.5.8.0 or higher) then it has a tool called `db2cli` which allows a command-line connectivity test for the odbc-driver, without needing any configuration files to be edited first. That can be useful to perform debugging (or tracing) for example `db2cli validate -connstring "DATABASE=...;HOSTNAME=...;PORT=...;UID=...;PWD=..." -connect`  (along with any other required connection string options).   

    IF you get a successful connection with this tool, then any odbc application should also connect if using the same connection-string, subject to correct config file settings, and the corrollary is also true.

    `db2cli validate -connect -dsn ...` also works if you create/edit db2dsdriver.cfg xml file to specify the connectivity details therein, in which case you can omit the -connstring "...." as the tool will get these details from the db2dsdriver.cfg file instead of the command-line.

    An example sequence of steps for tracing the odbc connection with db2trc and db2cli would be:
    (ensure the $PATH has the Db2-client bin directory on it, and LD_LIBRARY_PATH is configured correctly)

    db2trc on -f /tmp/iseries.dmp
    db2cli validate -connstring "DATABASE=...;HOSTNAME=...;PORT=...;UID=...;PWD=..." -connect
    db2trc off
    db2trc fmt /tmp/iseries.dmp /tmp/iseries.fmt
    db2trc flw /tmp/iseries.dmp /tmp/iseries.flw
    db2trc fmt -cli /tmp/iseries.dmp /tmp/iseries.fmtcli

    You can study these files (start with the fmtcli file, it will be short) to see what is happening.
    Or bundle the files and let an expert have a look.

    Otherwise, if you are still blocked, some people prefer (for i-series) to use a different IBM supplied driver than the regular Db2-client/runtime client. i.e, using the driver that comes with the `IBM i access` software, as it is available for linux x64 also, and it does NOT need a db2 connect license.  (This is only a suggestion, as a possible workaround.).



    ------------------------------
    Mike O'Reilly
    ------------------------------



  • 3.  RE: DB2 connect command hangs/does not complete

    Posted 4 days ago

    Thank you for your message. Your expertise/advice came very handy.

    I was able to use the trace to find that I am indeed still waiting for a response back from the i Series server. It seems that DRDA port may be of cause.

    I will once again update this thread once the issue is resolved.

    Thank you again!



    ------------------------------
    Howard Kim
    ------------------------------