Unanswered: Connection lost by Command Prompt - DB21061E Command line environment not initialize
I am trying to execute batch commands from Windows Command Prompt on DB2 v7.2 fp5 on Windows XP SP1 environment.
1. Start | Run
2. cmd <enter>
3. I executed command:
4. The above command returs some numeric number. This number I have put in Windows System Variable as DB2CLP=<number_got_in_step_3>
5. Then executed db2 commands:
db2 connect to sample
db2 select * from db2admin.table
The problem: Waiting for some secounds (e.g. 5 secound) then executing another SQL statement returs the error: "DB21061E Command line environment not initialized.". If I repeat connect command it works fine. Just waiting for some secounds connection is lost. Why does Windows Command Prompt lost connection? What should I do to overcome this problem?
brat4, DB2 Command Window works fine, but that is not my problem. I would like just to execute db2 commands from Windows Command Prompt!!! Now I have to execute first batch file to enable db2 environment and inside this first batch file I have to write command to run secound batch file witch has the db2 sql commands.
I would just like to have ONLY ONE batch file (like on Linux). So my problem is: How to run db2 sql commands from just one batch file?
Sathyaram_s, I know this solution, but this is not what I would like to have. I would like to have only one file - and this file should be the batch file. You wrote a solution with two files: batch and sql file.
The main problem I have is that I can't read the secound batch file output results in the main batch program. So I would like to have only one batch file like described in my first post. Now my solution works: secound batch file writes the data to temp file and then main batch program reads that file. I would like to get rid of temp file. Because script is so complex that it requires multiple temp files - this is disaster.
I just can't bealive that there is no solution on Windows, but there it is on Linux?
My solution from first post works fine, just I have problems of "connection lost" error! Can be something done to overcome this problem.