I am trying to run a batch file using SQL Agent.
.bat file: it opens a saved putty session using plink. Which is a mysql server hosted in AWS with keys saved in putty session.
plink -load putty_ss -l scar
I need to have this connection open for the linked server in SQL to work.
When i try to run from SSMS
EXEC master..xp_cmdshell 'K:\Open.bat it lists out the plink.exe commands and does not seem to execute the command after plink. I tried with quotes and w.o quotes no luck.
If i double click the bat file it can open the connection to the mysql server with my username with no issues, that way i can query the mysql db with the linked server in SQL.
I also tried using CMDExec in SQL and i get "the system cannot find the file specified" (There was a topic in this forum for that error but it wasnt useful as i had everything set correctly to begin with)
Can I open a bat file that opens a putty saved session using plink via SQL JOB?
Has anyone come across this scenario?
Is there a easier way? I have hit the brick wall and if anyone can help that will be great!