Praveen
Praveen

Reputation: 201

How to execute sqlplus commands on ssh enabled unix machine from java code

Hello all I have a requirement which should be accomplished from a java program .The requirement is as follows,

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

I am able to complete the first two tasks but I don't have any idea in completing the tasks in the 3 & 4 points.Any help will be well appreciated

Upvotes: 0

Views: 1437

Answers (1)

rafalopez79
rafalopez79

Reputation: 2076

In the snippet you post, set the command1 var for example to

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

Upvotes: 1

Related Questions