Unanswered: Once db2cmd instance Executing multiple CLP commands
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
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.