Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Easy Question: Test Connection

RE: Easy Question: Test Connection

From: <Stephen.Lee_at_DTAG.Com>
Date: Tue, 11 May 2004 01:31:42 -0500
Message-ID: <D6339830FC73944E889CC3CEADDB205B0790939B@bu-dtagpo1.tracs.com>

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_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Tue May 11 2004 - 01:28:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US