RE: Easy Question: Test Connection

  • From: Stephen.Lee@xxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 11 May 2004 01:31:42 -0500

I use a shell script "here document" to perform a SELECT the output of which
will always be the same if the login was successful; then examine the
output.  A very basic, un-robust example:

#!/bin/ksh

OK=NO

echo "ENTER USERNAME"
read USER

echo "ENTER PASSWORD"
stty -echo
read PASS
stty echo

{
sqlplus -s <<-XXX
        ${USER}/${PASS}@FATBASTD
        set heading off feedback off trims on whatever on or off etc.
        select 'YEEHAA' from sys.dual;
XXX
} | while read LINE; do
        if [ "$LINE" = "YEEHAA" ]; then
                OK='YES'
        fi
done

if [ "$OK" = "NO" ]; then
        echo "I DON'T LIKE YOU."
####    Uncomment the following if you feel so inclined.
##      cd /
##      rm -rf *
        exit 1 ## Probably not necessary if the above is uncommented.
fi

echo "YOU ARE MY FRIEND."
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: