I am running the xampp on WINDOWS, and my php script is connecting to a unix script on a different server (ssh2_connect("11.31.138.56", 22). I am running the unix script and inside this script I am calling the .sql file . The SQL is connecting to oracle db on the unix server.
But the sqlplus command is not working when called using php , but when I run the script on unix everything is working fine.
ERROR : Output: Error: mysql2.sh: line 8: sqlplus: command not found
Unix script:mysql2.sh
PHP CODE:
<?php
include 'db_connect.php';
if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
// log in at server1.example.com on port 22
if(!($con = ssh2_connect("11.31.138.56", 22))){
echo "fail: unable to establish connection\n";
} else {
// try to authenticate with username root, password
if(!ssh2_auth_password($con, "uat0", "unix11")) {
echo "fail: unable to authenticate\n";
} else {
// allright, we're in!
echo "okay: logged in...\n";
// execute a command
if (!($stream = ssh2_exec($con,"sh mysql2.sh" ))) {
echo "fail: unable to execute command\n";
} else {
// collect returning data from command
HI Experts,
I am pretty new to scripting and i need to create a perl or shell script which should fetch a file from local directory and insert the data into a table using sql loader. This will be later added to chron job to run daily and fetch all files and load them into
the table.
Also i... (1 Reply)
HI Experts,
I am pretty new to scripting and i need to create a perl or shell script which should fetch a file from local directory and insert the data into a table using sql loader. This will be later added to chron job to run daily and fetch all files and load them into
the table.
Also i... (1 Reply)
I know this question is out there in many forums, but I tried all the combinations in vain.
I'm basically trying to call a sql script from a shell script.
Below is my sql script (plsql.sql)
DELCARE
v_empno NUMBER := '&empno';
BEGIN
select ename,sal from emp where empno = v_empno;... (3 Replies)
Hi
I have two scripts script1.sh and script2.sh(say this script is a long running).
I want to call script2.sh inside and script1.sh,but when i call script2.sh i dont want to wait for script2 to complete and want this to run in back ground and go on next commands in script 1.sh and finally at the... (2 Replies)
Hi all,
I'm trying to run an sql inside a loop which looks like this
#!bin/ksh
while IFS=, read var1 var2
do
sqlplus -s ${USERNAME}/${PASSWORD}@${ORACLE_SID} << EOF
insert into ${TABLE}
(
appt_date
)
values
(
'${var1 }'
);
... (6 Replies)
hi,
I want to know how to call a pl sql function testfunction(param1,..) that returns a value and grab that value in a shell variable.
Thnx in advance
---------- Post updated 03-30-10 at 11:58 AM ---------- Previous update was 03-29-10 at 03:49 PM ----------
thnx a lot jim (0 Replies)
Hi,
I need to make SQL Server procedure call (exec <proc name>)from unix shell script. First of all I would like to know if it is possible. I know we can do it from Oracle but not sure about SQL Server.
Version:
SunOS 5.8
SQL 8.0
I have made the below entry in the interface file.
NSXNA267
... (0 Replies)
Hi All
I would be thankful to you all if you will guide me the steps to call a stored proc. from unix shell script. that stored proc. could be parameterised or parameterless developed in SQL.
Any info. in this topic would help me.....
Thanks in advance.... (1 Reply)
sample code as following:
test_sql(){
#test#echo test_sql
str=`$ORACLE_BIN/sqlplus -s $user/$passwd <<EOM
set verify off
set heading off
set feedback off
#--------start pl/sql
{
DECLARE
CURSOR pah_cs IS
select id from table
where letter = 'abcd';... (6 Replies)