Correct me if i'm wrong, but by adding "#!/bin/ksh" at the start of a script will force it to run in the korn shell no matter which shell you are currently using?? (2 Replies)
I'm using solaris and i have an old script that an ex employee wrote but i can't seem to get it working. well is just one part of the script
if ($?MC_PROD_DIR == 0) setenv MC_PROD_DIR $HOME/PRODUCTION
source $MC_PROD_DIR/scripts/localenv
** i understand what this part of the script is... (1 Reply)
Can anyone help with these scripts? Im new to this and struggling. Thank you for your help.
Pre-requisites
Create a file with x amount of lines in it, the content of your choice. (Have already done this)
Script 1
Write a script that takes two arguments. The first being a line of text,... (3 Replies)
Anyone know why this won't work?
#!/usr/bin/ksh
for db in `cat /etc/oratab|egrep ':N|:Y' | grep -v \* | cut -f1 -d":"`
do
echo "************************"
echo "database is $db"
echo "************************"
done
I am getting an error on the line... (7 Replies)
Here is my problem.
I have a txt file with a list of user names in both upper case and lower case. I need to remove the names from the passwd file. I want to be able to run a script that looks at my txt list and then removes those names from the passwd file. It would be nice if it backed up the... (3 Replies)
I am trying to write a script to check the STIG our unix boxes. I want to put in checks to determine if certain files or directories are there. For example:
If /opt/SUNWexplo exists
echo "Sun Explorer exists"
else
echo "Sun Explorer is not installed"
I am sure I could write... (2 Replies)
I have a script that will calculate some information about the current directory that I run the script in. How can I have it where it gets an argument from the user(such as a directory) and the script calculate the information for the given directory? Any help is greatly appreciated. (8 Replies)
How can I include a counter in this if statement so only sends out 5 notifications.
# the if statement will check for the lines status, if status is down sends email
if
then
LIST="user@email.com"
mail -s "rje_lines_down" $LIST < ${tmpfile} #sends an email to list
fi
thanks... (2 Replies)
Gents for 2013 I have embarked on learning C and just wrote my first script and need some help. In the learning process, I am trying to understand where I went wrong with my script. The flow of the script is as such:
Enter a number --> check if it is a number --> if it is not a number,print what... (4 Replies)
Discussion started by: metallica1973
4 Replies
LEARN ABOUT PHP
sqlsrv_connect
SQLSRV_CONNECT(3)SQLSRV_CONNECT(3)sqlsrv_connect - Opens a connection to a Microsoft SQL Server databaseSYNOPSIS
resource sqlsrv_connect (string $serverName, [array $connectionInfo])
DESCRIPTION
Opens a connection to a Microsoft SQL Server database. By default, the connection is attempted using Windows Authentication. To connect
using SQL Server Authentication, include "UID" and "PWD" in the connection options array.
PARAMETERS
o $serverName
- The name of the server to which a connection is established. To connect to a specific instance, follow the server name with a
forward slash and the instance name (e.g. serverNamesqlexpress).
o $connectionInfo
- An associative array that specifies options for connecting to the server. If values for the UID and PWD keys are not specified,
the connection will be attempted using Windows Authentication. For a complete list of supported keys, see SQLSRV Connection
Options.
RETURN VALUES
A connection resource. If a connection cannot be successfully opened, FALSE is returned.
EXAMPLES
Example #1
Connect using Windows Authentication.
<?php
$serverName = "serverNamesqlexpress"; //serverNameinstanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"dbName");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
Example #2
Connect by specifying a user name and password.
<?php
$serverName = "serverNamesqlexpress"; //serverNameinstanceName
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
Example #3
Connect on a specifed port.
<?php
$serverName = "serverNamesqlexpress, 1542"; //serverNameinstanceName, portNumber (default is 1433)
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
NOTES
By default, the sqlsrv_connect(3) uses connection pooling to improve connection performance. To turn off connection pooling (i.e. force a
new connection on each call), set the "ConnectionPooling" option in the $connectionOptions array to 0 (or FALSE). For more information, see
SQLSRV Connection Pooling.
The SQLSRV extension does not have a dedicated function for changing which database is connected to. The target database is specified in
the $connectionOptions array that is passed to sqlsrv_connect. To change the database on an open connection, execute the following query
"USE dbName" (e.g. sqlsrv_query($conn, "USE dbName")).
SEE ALSO sqlsrv_close(3), sqlsrv_errors(3), sqlsrv_query(3).
PHP Documentation Group SQLSRV_CONNECT(3)