The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Executing pl/sql using sqlplus on unix maverick1234 Shell Programming and Scripting 1 02-11-2008 10:32 AM
Executing pl/sql using sqlplus on unix maverick1234 UNIX for Advanced & Expert Users 1 02-10-2008 07:21 AM
Executing pl/sql using sqlplus on unix maverick1234 High Level Programming 1 02-10-2008 07:19 AM
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 12:31 PM
Executing UNIX command from java on NT CJ Walt UNIX for Dummies Questions & Answers 1 06-25-2003 10:39 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-16-2008
Registered User
 

Join Date: Feb 2008
Posts: 2
Executing SQLPLUS in UNIX Script from JAVA

Hi ALL,

I would like to execute one SQL query(ORACLE) in UNIX shell script. For this I used sqlplus in script and tested locally. It worked fine. But my requiremnt is to execute the script from Java. In this case the UNIX part is working but sqlplus is not returning anything
The JAVA code used is as follows:
String user="UNIX_username";
String host="138.108.222.30";
String cmd="ksh script_name.sh";
try
{
Session session=jsch.getSession(user,host,22);
session.setPassword("password");
UserInfo usrInfo=new MyUserInfo();
session.setUserInfo(usrInfo);
session.connect();
Channel channel=session.openChannel("exec");
((ChannelExec) channel).setCommand(cmd);
channel.setXForwarding(true);
channel.connect();



Could anyone of you give some ideas on the above ?

Thanks,
ANoo

Last edited by anooptech; 04-16-2008 at 06:00 AM.
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0