A general solution for calling DB queries from a shell script:
You could probably assign the full output of the select to a variable and then make your comparison to validate table creation possibly like this. I don't have an Oracle DB to play with and the syntax might not be quite right but the idea should be reasonable:
I have a shell script which resides on three SCO machines containing some simple sqlplus statments. I need to run these scripts remotely. Currently, I am trying to use rsh to do so:
rsh hostname myscript args
The problem is that the arguments to the sqlplus statements in the remote shell... (4 Replies)
hi,
my first question is :-
i would like to know how do i loop through the output of a variable.
for ex:- if i have a variable called x and echo $x gives the output like
feb 19 07
feb 20 07
feb 21 07
i would like to know how do i loop through this since it is separated and i... (1 Reply)
Situation: I have a working shell script on our file server (OSXS Tiger) to connect to a workstation, which is using a portable home directory (phd), and rsync a user's MirrorAgent.log. I'm not that strong of a scripter (obviously), but I would like to add other workstations to this script as they... (4 Replies)
Hi-
I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment...
I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Hello,
On unix side, I have written below script for taking oracle db backup. But when I tried to execute it - i could not execute the sql statements from unix.
Please suggest
------------------------
$ more bkp.sh
#!/bin/ksh
# make sure database is shutdown cleanly
sqlplus '/ as sysdba'... (3 Replies)
Hi,
assume there are some dir structure like -
I need to write a script to create 5 new directories under 'qwe' dir of all the above 3 dir structures. these 5 dir will have same name.
I don't want to use 15 mkdir statements. i just want to write 5 mkdir statemets and use them 3 times. I... (10 Replies)
Hi,
As per my understanding, we can use two shebang statements in a single shell script. Please see below snippet-
#!/bin/bash
.......## some code A
#!/bin/csh
.......## some code B
exit 0;
Here, code A will be executed using bash shell and code B will be executed with c shell.
... (9 Replies)
I cannot get the code below to work correctly. The IF statement works just fine, but not the looping. The inner loop tries to find files for a given vendor; if found, I need to sleep giving another process time to move the files. Once the given vendor's files are gone, then I want to move on to the... (1 Reply)
Hi,
Iam using below code to login to servers to get cpu utilisation. but output is coming for only one server. code is below
root@blr-svr-oclan-01 # more SSSC_CPU_UTIL1.sh
#!/bin/sh
echo "CPU UTILIZATION"
while read line; do
IDLE=`/usr/local/bin/sshpass -p 'xxx' ssh xxx@$line 'sar 2 2' |... (1 Reply)
hi all,
i have made a shell script and it runs until it reaches the if statement, doesn't the ! mean only if the command fails it will echo me that message and then exit
can anyone please help me what is wrong with my code?
many thanks,
rob
#!/bin/bash
echo "is this archive... (10 Replies)
Discussion started by: robertkwild
10 Replies
LEARN ABOUT PHP
mssql_pconnect
MSSQL_PCONNECT(3)MSSQL_PCONNECT(3)mssql_pconnect - Open persistent MS SQL connectionSYNOPSIS
resource mssql_pconnect ([string $servername], [string $username], [string $password], [bool $new_link = false])
DESCRIPTION mssql_pconnect(3) acts very much like mssql_connect(3) with two major differences.
First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and
password. If one is found, an identifier for it will be returned instead of opening a new connection.
Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for
future use (mssql_close(3) will not close links established by mssql_pconnect(3)).
This type of links is therefore called 'persistent'.
PARAMETERS
o $servername
- The MS SQL server. It can also include a port number. e.g. hostname:port.
o $username
- The username.
o $password
- The password.
o $new_link
- If a second call is made to mssql_pconnect(3) with the same arguments, no new link will be established, but instead, the link
identifier of the already opened link will be returned. This parameter modifies this behavior and makes mssql_pconnect(3) always
open a new link, even if mssql_pconnect(3) was called before with the same parameters.
RETURN VALUES
Returns a positive MS SQL persistent link identifier on success, or FALSE on error.
EXAMPLES
Example #1
mssql_pconnect(3) using the $new_link parameter
<?php
// Connect to MSSQL and select the database
$link1 = mssql_pconnect('MANGOSQLEXPRESS', 'sa', 'phpfi');
mssql_select_db('php', $link1);
// Create a new link
$link2 = mssql_pconnect('MANGOSQLEXPRESS', 'sa', 'phpfi', true);
mssql_select_db('random', $link2);
?>
PHP Documentation Group MSSQL_PCONNECT(3)