i would like to ask a very simple question, i have a script which will connect to oracle database for some activities
If i executed the scriptfrom PUTTY, it able to connect to database BUT if i execute the script in Python using paramiko client, it cant connect to database.
I guess it's environment issue but i'm not quite sure. Please give your opinion.
Below is the exact command i use in putty.
cd tes1/test2/runtime/; ./test.init.start
And this is what I try in Python with Paramiko:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('<Hostname>', username='<username>', password='<password>')
stdin, stdout, stderr = client.exec_command('cd tes1/test2/runtime/; ./test.init.start')
UPDATE:
ERROR MESSAGE=
?WCSERV-F-Error during connect to data base
?SQ-F-connect to database failed
ORA-12162: TNS:net service name is incorrectly specified
LATEST UPDATE:
Hi i solved this and i figured this might help others, so the reason was the environment path messed up as im using paramiko, tried many ways but only 1 work which is running the script explicitly via login shell for example : bash --login -c "ls"
, goodluck!