Topic
  • 5 replies
  • Latest Post - ‏2013-04-04T14:47:44Z by SystemAdmin
SystemAdmin
SystemAdmin
17917 Posts

Pinned topic db2 & cygwin

‏2006-08-02T06:31:07Z |
I have always used cygwin interface on windows
upto v9 never had a problem
since I installed V9 there is something strange
db2 connect to xxx <<-- ok
db2 list tables for schema <<--- no database connection
in db2 command window I don't have this problem
this only occures with V9 and not with V7 or V8
tried it on different machines and same problem
Any idea ?
Thanks for all help/info
Best Regards, Guy Przytula
Updated on 2013-04-04T14:47:44Z at 2013-04-04T14:47:44Z by SystemAdmin
  • rchase
    rchase
    7 Posts

    Re: db2 &#38; cygwin

    ‏2006-08-03T21:17:45Z  
    Hi,

    In DB2 9, since you can install multiple DB2 products on the same system, there have been some changes in the way command line works. I have cygwin on one of my test boxes, and I don't usually work in it, but I just tried it and this is what I saw:
    • if I start up a bash shell within a normal CMD window, then try and connect to the sample db, I get "DB21061E Command line environment not initialized."
    • if I start a bash shell from within a DB2 command window, I can connect to sample db without problems.

    Try opening a DB2 Command Window from the start menu and then start your bash shell from in there, this should take care of the problem.

    We use the db2cw.bat file from sqllib\bin to open a command window, so you might also be able to take a look in that batch file to see what env vars are being set to do the same thing in your bash window without running db2cw.bat. I have not tried this though.

    Ryan Chase
    DB2 Express Community team
  • rchase
    rchase
    7 Posts

    sorry, spoke too soon

    ‏2006-08-03T21:21:06Z  
    • rchase
    • ‏2006-08-03T21:17:45Z
    Hi,

    In DB2 9, since you can install multiple DB2 products on the same system, there have been some changes in the way command line works. I have cygwin on one of my test boxes, and I don't usually work in it, but I just tried it and this is what I saw:
    • if I start up a bash shell within a normal CMD window, then try and connect to the sample db, I get "DB21061E Command line environment not initialized."
    • if I start a bash shell from within a DB2 command window, I can connect to sample db without problems.

    Try opening a DB2 Command Window from the start menu and then start your bash shell from in there, this should take care of the problem.

    We use the db2cw.bat file from sqllib\bin to open a command window, so you might also be able to take a look in that batch file to see what env vars are being set to do the same thing in your bash window without running db2cw.bat. I have not tried this though.

    Ryan Chase
    DB2 Express Community team
    Hi,

    Sorry, spoke too soon, I'm also losing my connection from within the bash shell.

    I will enquire into this error and see what else I can find out.

    Ryan Chase
    DB2 Express Community team
  • rchase
    rchase
    7 Posts

    Suggestion from DB2 development team

    ‏2006-08-03T22:04:48Z  
    Hi,

    A friend on the DB2 development team had this to say about your problem:

    DB2 v9 has a different mechanism to figure out the PPID for a process. Have them try the following in their bash shell:

    export DB2CLP=**$$**
    then run their DB2 commands

    Ryan Chase
    DB2 Express Community team
  • SystemAdmin
    SystemAdmin
    17917 Posts

    Re: Suggestion from DB2 development team

    ‏2006-08-04T05:53:32Z  
    • rchase
    • ‏2006-08-03T22:04:48Z
    Hi,

    A friend on the DB2 development team had this to say about your problem:

    DB2 v9 has a different mechanism to figure out the PPID for a process. Have them try the following in their bash shell:

    export DB2CLP=**$$**
    then run their DB2 commands

    Ryan Chase
    DB2 Express Community team
    Yes, thanks.
    this corrected the problem.
    Again a happy DB2/Cygwin user
    Best Regards, Guy Przytula
  • SystemAdmin
    SystemAdmin
    17917 Posts

    Re: Suggestion from DB2 development team

    ‏2013-04-04T14:47:44Z  
    Yes, thanks.
    this corrected the problem.
    Again a happy DB2/Cygwin user
    Best Regards, Guy Przytula
    Sorry to bring up such an old thread again, but I have almost exactly the problem described here. I am using DB2 Express C 9.7.5 on 32-bit Windows 7 as a local client to connect to various DB2 servers of type DB2/NT64 9.7.5 (development systems) and DB2/AIX64 9.7.5 (test and production).

    Under Cygwin (settings below), I find that the persistent DB2 connection established with "db2 connect to ..." is preserved only for 5 seconds; that is, as long as successive db2 commands follow each other with less than 5 seconds in between, the connection is preserved; but when there is a break of more than 5 seconds, I get "SQL1024N A database connection does not exist. SQLSTATE=08003".

    Is there a way to preserve the connection without such a short timeout, as under Unix and in the Windows command shell? This would help greatly to make admin scripts compatible between Cygwin and Unix/Linux.

    Regards,

    Oliver Schoett

    Environment settings (1320 is the pid of the Cygwin bash shell):

    $ set | grep DB2
    DB2CLP='**1320**'
    DB2INSTANCE=DB2
    DB2PATH='C:\app\DB2_Express_9.7.5'
    INCLUDE='C:\app\DB2_Express_9.7.5\INCLUDE'
    LIB='C:\app\DB2_Express_9.7.5\LIB'
    PATH=/c/Users/oschoett/home/bin/nt386:/c/Users/oschoett/home/bin:/usr/local/bin:/usr/local/bin:/c/app/emacs-24.2.93/bin:/c/app/jdk1.7.0_13/bin:/c/app/DB2_Express_9.7.5/bin:/bin:/usr/X11R6/bin:/c/WINDOWS/system32:/c/WINDOWS

    $ type -a db2
    db2 is /c/app/DB2_Express_9.7.5/bin/db2