Re: Hide Password in SQL Plus

From: Ivan Samuelson <bolski_at_indy.net>
Date: 1996/09/14
Message-ID: <323aba36.661403_at_news.indy.net>#1/1


On Thu, 12 Sep 1996 21:36:41 -0500, Alexander Lyakhovetsky <alexl_at_wwa.com> wrote:
>We are using sqlplus in shell scripts. In order to connect to a
>database, we have to pass connect string but password becomes visibale
>if you run ps command. Is there any way to hide password from ps
>command?
>
>Here is a couple of lines from our script.
>
>CONNECT=dbid/password
>sqlplus $CONNECT
>
>Thanks, Alex
>
I'm assuming since you said "shell script", that you're using UNIX.

One way to do it is this:

  1. Put the password into a text file. Do a chmod 0400 on it so that only the owner can read it. In our example, call it password.txt.
  2. In the shell script, call SQLPLUS and your SQL script as follows:

                sqlplus (username) _at_sql_script < password.txt

Another way you can do it doesn't depend on what OS your running on. You can have the username and password at the top of your sql script and call SQLPLUS as follows:

                sqlplus _at_sql_script

The rest of your scrip follows the username and password.

Hope this helps!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Ivan Samuelson, Consultant       *   LET 'ER RIP! GO HORSE!
Profound Consulting              *   bolski_at_indy.net
http://www.indy.net/~profound    *   http://chaos.taylored.com/home/bolski/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Received on Sat Sep 14 1996 - 00:00:00 CEST

Original text of this message