如何从java代码在启用ssh的unix机器上执行sqlplus命令

时间:2014-12-20 15:57:43

标签: java unix ssh sqlplus

大家好,我有一个应该从java程序完成的要求。要求如下,

   1.Connect to an SSH enabled unix machine 
   2.Login to sqlplus on the unix machine
   3.execute sqlplus commands
   4.Come out.

我能够完成前两个任务,但我不知道完成3& 3中的任务。 4分。任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

在您发布的代码段中,将command1 var设置为

String command1= "echo 'SELECT 1 FROM DUAL;' | sqlplus user/password@tnsname";