Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    India
    Posts
    14

    Cool Unanswered: Once db2cmd instance Executing multiple CLP commands

    Hi friends
    I execute db2 commands thru a webpage using PHP script..For executing db2 commands ,i need to call db2cmd

    everytime like this to initialise command line environment.
    <?php Start of PHP
    //Initialised session
    ..
    .
    system('db2cmd /c /w /i db2 get instance');
    system('db2cmd /c /w /i db2 connect to sample');
    system('db2cmd /c /w /i db2 select * from staff');
    .
    .
    //Close the session
    ?> End of PHP

    The problem here is the commands getting executed in separate environments which gives erroneous o/p
    ie after connecting to sample database,i tried to select the values from the table staff,I get this error
    "Database connection does not exist". Anybody pls tell me how to initialise command line envoironment once and execute db2 commands in it until i terminate from the enviroment.Thanx in advance.
    Bye
    With regards
    Vram

  2. #2
    Join Date
    Dec 2003
    Posts
    1
    Try


    open(DB2CMD,'| db2cmd /c "connect to infqas user db2inst1 using db2inst1", "db2 list tablespaces>C:\TEST.lst","db2 terminate"');
    close(DB2CMD);


    Galit.

Posting Permissions

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