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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL*Plus, SQL*Load - How to hide password?

Re: SQL*Plus, SQL*Load - How to hide password?

From: Phil Herring <revdoc_at_uow.edu.au>
Date: 1997/12/03
Message-ID: <6629dt$94d$1@wyrm.its.uow.edu.au>#1/1

In article <34841DAD.41C67EA6_at_cs.huji.ac.il> Nir Dagan, nirda_at_cs.huji.ac.il writes:
>I know one way is to enter the password manualy while connecting, Is
>there another way, in which I wont need to type anything during the run?

In most Unixes, if it's on the command line, it can be seen, and there's no 100% certain method of concealing it. The simplest solution is to build a shell script and run that instead, so that the username and password are not on the command line. It will probably look like this:

	#!/bin/sh
	sqlplus <<EOF
	scott/tiger_at_db
	@some_sql_file
	EOF

This uses the little-known 'here document' feature of the Bourne shell - the "<<EOF" instructs the shell to take everything up to "EOF" as standard input. (You can use any string instead of "EOF". I generally use "!".) You can write a script using shell variables:

	#!/bin/sh
	USERNAME=scott
	PASSWORD=tiger
	DATABASE=db
	SCRIPT=some_sql_file
	sqlplus <<EOF
	$USERNAME/$PASSWORD@$DATABASE
	@$SCRIPT
	EOF

This is somewhat cryptic to read, but is regarded as better coding style, especially if you do more than connect once and run one SQL script.

(Extending this solution to SQL*Loader has been left as an exercise for the reader :)



Copyright 1997 Phil Herring. This article may not be reproduced for profit.
Received on Wed Dec 03 1997 - 00:00:00 CST

Original text of this message

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