I need to run a shell script which is executed through java. but when i am running from java it is unable to identify sqlplus command and throwing error for sqlplus as no such file or directory..
My shell Script code is below
function CHECK_CONNECTION {
PATH=/data01/u03/TestABC/apps/tech_st/10.1.2/bin:${PATH} ---> Path for Sqlplus
WRITE_MESSAGE "Checking database connection details"
UNAME_PASSWD=${1}
count=0
while [ $count -lt 3 ];do
sqlplus -s ${UNAME_PASSWD}@${DBSID} <<-SQL >> $LOG_FILENAME
WHENEVER OSERROR EXIT 9;
WHENEVER SQLERROR EXIT SQL.SQLCODE;
prompt Connected to the database;
quit; SQL
conn_code=$?
if [ $conn_code -ne 0 ]; then
count=`expr $count + 1`
WRITE_MESSAGE " Trying to connect $count time..\n"
else
WRITE_MESSAGE "Database connectivity is working fine.................\n"
break
fi
done
if [ $count -eq 3 ]; then
WRITE_MESSAGE "Database connectivity is not working fine!!!!!check the username/password\n"
exit 1
fi
I am giving DB details through java UI. Details are reaching correctly in UNIX shell through java.
But same command when I am executing from shell works fine and gets connected to database. So is their any way through which I can get connected to DB without using any client like sqlplus or is their any other way to do such.
any help will be highly appreciated.