Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746

    Question Unanswered: Ugly bypass, is there a better solution?

    On linux, one can type:
    Code:
    time db2 "connect to sample"
    time db2 "select * from employee"
    On MSwin I recently found "timethis.exe" which does the same. But when I try the same sequence on windows it seems that the db2 connection can not be used in the "timethis" shell.

    I found an ugly bypass, which I only use on my test-servers:
    Code:
    db2set db2dbdft=sample
    This is an option I do not like to use or propagate.. is there a better way to solve my problem?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I assume you want to see the timings of the statements you are trying to execute. Try doing something like this:

    1) place all the statements into a file.
    2) insert a select statement that gets the current time between each statement.
    3) save the file
    4) execute the script using db2 -tvsf <filename> (use the appropriate options depending on your script).

    The script file would look like this:
    -------------------------
    connect to sample;
    select current timestamp from sysibm.sysdummy1;
    select * from employee;
    select current timestamp from sysibm.sysdummy1;
    -------------------

    Andy

  3. #3
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Thanks, but I was more looking for a way to let DB2 "enherit" the connection in a child process. This works on linux and, if I recall well, it used to work on windows while on DB2 V8.
    Something changed in V9, it does not behave the same. And the "db2dbdft" approch should be avoided don't you think?

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    db2dbdft :This variable specifies the database alias name of the database to be used for implicit connects. If an application has no database connection but SQL or XQuery statements are issued, an implicit connect will be made if the DB2DBDFT environment variable has been defined with a default database.
    what is meant by : DB2 "enherit" the connection in a child proces
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  5. #5
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Quote Originally Posted by przytula_guy
    what is meant by : DB2 "enherit" the connection in a child proces
    From db2cmd on ms-win:
    when you type:
    Code:
     
    timethis db2 connect to sample
    db2 connect
    then the 2nd will indicate that no connection exists. This makes sence because the the program "timethis" owned the connection and is finished now

    But when you type:
    Code:
     
    db2 connect to sample
    timethis db2 connect
    db2 connect
    you will see that the 2nd command will have no connection, and the 3rd does have one. I would expect/desire that the 2nd command would enherit the connection from it's root (db2cmd).

    Is there someone on DB2 V8 on windows to confirm that this does work?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •