Hi,
I would like to connect to db2 from command prompt and execute batch file which will get result from my connection.
Windows:
1. I open text editor and paste the following text to it:
Code:
db2 connect | find "Local"
2. Save file test.bat
3. Open DB2 Command Window
4. Connect to sample database from command prompt
Code:
db2 connect to sample
5. Execute test.bat file:
I get output:
Local database alias = SAMPLE
OK, Windows works fine, but the problem is on Linux.
Linux:
Doing the same thing in Linux:
1. I open text editor and paste the following text to it (bash is my default shell):
Code:
db2 connect | grep Local
2. Save file test.sh
3. Make file executable:
4. Connect to sample database from shell
Code:
db2 connect to sample
5. Execute test.sh file:
I get no! output. But executing the same command (from step 1) I get:
Local database alias = SAMPLE
It looks like Linux opens new process when executing batch file.
Is there any way I could get info when executing shell file from shell just like on Windows?
My system:
db2 v8.2 on Windows and Linux