Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PLSQL question
This little SQL*Plus script may come handy in this situation:
rem VALCONN.SQL - Validate login/password_at_instance
rem
rem to use:
rem
rem sqlplus -s /nolog @valconn.sql <username> <password> <instance>
rem
rem if the exit code is NOT 0, then the connection was NOT successful
set verify off feedback off termout off
whenever oserror exit 9
whenever sqlerror exit sql.sqlcode
set define '$'
connect $1/$2@$3
exit
just call this in your shell script to verify that connection parameters are valid and evaluate the exit code before doing anything else in the script. It will silently try to connect to the db and return non-zero exit code on any error.
-- Vladimir Zakharychev (bob@dpsp-yes.com) http://www.dpsp-yes.com Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications. All opinions are mine and do not necessarily go in line with those of my employer. "Andy Hardy" <newsnov01_at_ahardy.demon.co.uk> wrote in message news:$m4zViFOihE8Ew8O_at_ahardy.demon.co.uk...Received on Mon Dec 10 2001 - 07:49:13 CST
> In message <KboQ7.7261$Sj1.2912623_at_typhoon.ne.mediaone.net> , Murty
> Adavi <adavi_at_mediaone.net> writes
> >How do I make PLSQL NOT prompt 3 times for correct login/password info.
> >I am calling PLSQL from a shell script and I want it to exit out if
> >login/password
> >is wrong and not wait for correct login/password.
> >
>
> That's not PL/SQL prompting, it's the SQL*Plus session that you are
> starting up.
>
> Perhaps you should try to verify the password in one call to the
> database before you try to log onto it with your desired PL/SQL script?
>
> Andy
>
> --
> Andy Hardy. PGP ID: 0xA62A4849
> ===============================================================