Calling DB user from separate file in Shell script

Hi All,

I need to execute a SQL via shell script and i am connecting to Oracle DB by this way $USERNAME1/$PASSWORD1@$STRING1 and i need to get username, password and string from someother file stored in the Unix Directory. $Username, $Password and $String is stored in File A in Path A and i want to call it in the test.sh in Path B.

Format of File A.txt

Username=test_db
Password=*****
Instance=ORACLEDB

Require your assistance!!!

Regards,
Sathish

So ?

What is the problem you have ?

How to parse the input file to get username,password & instance into variables ?

How to make an SQL call from shell ?

Hi,

I need to know the way to get the username and password from the other file. How to call that file and get the required values for SQL call??

user@host> (/home/user) $ cat test1.txt
Username=test_db
Password=*****
Instance=ORACLEDB
user@host> (/home/user) $ cat  test.sh
user=`awk -F\= '/Username/{print $2}' test1.txt`
echo $user

user@host> (/home/user) $ cat test1.txt
user@host> (/home/user) $ ./test.sh
test_db
user@host> (/home/user) $

This is a way you can access your params from other file. And for sql you can use sqlplus /isql.