Hi ALL,
I need to connect, from windows, to a db2 database sitting on a UNIX server, run a few commands against the server as well as the database and save the output to a file.
I created a batch file test.bat and it contains the following:
Code:
@ECHO OFF start SecureCRT.exe /SSH2 /L <login_name> /PASSWORD <password> <IP>
Running this batch file would connect me to the server. However I still need to connect to the database and run my commands.
I tried adding the following to the batch, but once it connects to the server, it ignores the rest.
Code:
@ECHO OFF start SecureCRT.exe /SSH2 /L <login_name> /PASSWORD <password> <IP>
db2 list applications > temp.out
db2 connect to <database> >> temp.out
db2 SELECT * FROM SYSIBM.DUAL >> temp.out
Even if I create two separate files: one to connect to the server and add a line in it to run the second file, where it connects to the database. It didn't work.
test.bat
Code:
@ECHO OFF start SecureCRT.exe /SSH2 /L <login_name> /PASSWORD <password> <IP>
test2.bat
test2.bat
Code:
db2 list applications > temp.out
db2 connect to <database> >> temp.out
db2 SELECT * FROM SYSIBM.DUAL >> temp.out
I'm on WindowsXP. The server is UNIX 5.3 and the database is DB2 9.7
Any idea on how to proceed would be much appreciated!!