How to establish a DB2 connection in while loop using Shell script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikyalex4
    New Member
    • Apr 2012
    • 1

    #1

    How to establish a DB2 connection in while loop using Shell script

    Hi ,
    I have to create a db2 connection for the while loop in shell scripting.

    Below is the while loop.
    while read TABLE; do
    db2 LOAD CLIENT FROM
    $DIRECTORY/$TABLE.ixf OF ixf INSERT INTO TABLENAME NONRECOVERABLE INDEXING MODE REBUILD ALLOW NO ACCESS;
    done < $input_file


    how to create connection for the above while loop..please help me
  • jonathanw
    New Member
    • May 2012
    • 1

    #2
    Hi,
    To make db2 connect in a sub shell, set the following shell environment variable :
    export DB2DBDFT=yourda tabasename

    (if you had a previous failed attempt to connect to the db you may need to do a "db2 terminate" first )

    Comment

    Working...