Sponsored Content
Top Forums Shell Programming and Scripting Hide and retrieve database credentials Post 303006015 by Pradeep_Raj on Thursday 26th of October 2017 03:41:35 AM
Old 10-26-2017
Hide and retrieve database credentials

Hi Everyone,
I am new to shell scripting and I have a requirement to fire a sql statement to Oracle database and create a out file in Unix server.
This will be plugged in to Autosys as a batch job.

I have the database credentials saved in a configuration file in the below format.

dbdata.cfg:
Code:
GN1 dbname dbuser dbpwd

The actual script shown below:
miscript.sh:
Code:
DBNAME= `awk '{print $2}' /home/mireport/dbdata.cfg`
DBPWD= `awk '{print $4}' /home/mireport/dbdata.cfg`
DBUSER= `awk '{print $3}' /home/mireport/dbdata.cfg`
OUTFILE= /home/mireport/testmi.csv

sqlplus -S ${DBUSER}/${DBPWD}@${DBNAME}" <<SQLEND >> ${OUTFILE}
 set pages 0 feed off head off
 alter session set current_schema=Schema_Owner;
select column1 from testfile;

exit
sqlend

Getting the below error when exceuting the script, can you provide some help on this?

Code:
$ sh miscript.sh
test.sh: dbpwd:  not found.
test.sh[2]: dbname^M:  not found.
test.sh[3]: dbuser^M:  not found.
test.sh[4]: /home/mireport/testmi.csv^M:  not found.
test.sh[5]: ^M:  not found.
test.sh[6]: sqlplus:  not found.


Last edited by Scott; 10-26-2017 at 04:47 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ldap : Invalid credentials

Hi All, :) I have configure openldap but when I test this its show me a massage that "Invalid Creedientials". I search for the slove at Google, Yahoo but I did not find any solution. Plz help me. :cool: (3 Replies)
Discussion started by: Sudipta Biswas
3 Replies

2. AIX

Telnet Credentials

Dears i am going to write a shell script to do some administration jobs and automate them , but i need to access remote servers through telnet so my question is how to pass the required credentials to telnet through shell script or can i use a file and redirect the standard input to be from that... (3 Replies)
Discussion started by: TheEngineer
3 Replies

3. Shell Programming and Scripting

A script pls( To retrieve database information)

KSH - Unix -AIX - db2 ************** Get the input from the user say '123' (It varies) Then i want to connect to a database say "D1" then i want th extract from the database by giving "select * from tablename where input = '123' I also want to connect to another database "D2" then i... (3 Replies)
Discussion started by: rollthecoin
3 Replies

4. Shell Programming and Scripting

Hide DB Credentials in unix

Hi, I my unix we have one file that contains all the database credentials. we are calling that file while connecting databse. I need to hide that file....other user should not view that file. How to do this. Please suggest me apart from permisstion(chmod) level suggestion. Regards,... (3 Replies)
Discussion started by: rsivasan
3 Replies

5. Shell Programming and Scripting

FTP credentials from a config file

Hi, I am using the following syntax to connect to an FTP server and paste the file. Based on the value in the variable $Folder, i want to connect to different folders on the same server. The credential is different to access different folders. How to get the user name and password from a... (3 Replies)
Discussion started by: ashok.k
3 Replies

6. Shell Programming and Scripting

Wget/curl credentials validation

Experts, I login to a 3rd party and pull some valuable information with my credentials. I pass my credentials via --post-data in wget. Now my Account is locked. I want my wget to alert that the Account is locked. How can i achieve this. My idea is, get the Source page html from the... (2 Replies)
Discussion started by: sathyaonnuix
2 Replies

7. Shell Programming and Scripting

Logging into device with other set of credentials

If I run the below code... it will login into the router and then changes to privilege mode and then stores the running configuration information to an array. In this program, I have included the username and password . In case the username and password is wrong.. it will re login for 2 times... (0 Replies)
Discussion started by: scriptscript
0 Replies

8. UNIX for Advanced & Expert Users

Need to pass credentials in one Go

Hi, We usually switch user using the below command. sudo su - user1 It then prompts for the password which we feed in. I wish to pass both the username and the password in one go thus eliminating the prompt for the password. I am using java standalone to connect to unix using... (11 Replies)
Discussion started by: mohtashims
11 Replies

9. Programming

How to hide from UNIX strings - obfuscate or hide a literal or constant?

Hi, I need to somehow pipe the password to a command and run some SQL, for example, something like echo $password | sqlplus -s system @query01.sql To make it not so obvious, I decided to try out writing a small C program that basically just do echo $password. So now I just do x9.out | sqlplus... (8 Replies)
Discussion started by: newbie_01
8 Replies

10. UNIX for Advanced & Expert Users

Help with credentials when using Grep across multiple servers

Hello all, I need some help with a script I have been working on. I was wanting to know if it is possible to add authentication to it for each server it runs across? The credentials are all the same on each server. This is what I am using so far and it seems to work. I am trying to avoid... (3 Replies)
Discussion started by: Smorgen
3 Replies
BIORUBY(1)						      General Commands Manual							BIORUBY(1)

NAME
br_bioflat.rb -- OBDA flat file indexer SYNOPSIS
Search: br_bioflat.rb [--search] [options...] br_bioflat.rb [--search] [--location DIR] [--dbname DBNAME] [options...] [KEYWORDS] Create index: br_bioflat.rb [--create] [--location DIR] [--dbname DBNAME] [--format genbank|embl|fasta] [options...] [--files FILES...] Update index: br_bioflat.rb [--update] [--location DIR] [--dbname DBNAME] [options...] [--files FILES...] Show namespaces: br_bioflat.rb [--show-namespaces] [--location DIR] [--dbname DBNAME] [DIR/DBNAME] br_bioflat.rb [--show-namespaces] [--format=CLASS] br_bioflat.rb [--show-namespaces] [--files file] DESCRIPTION
This manual page documents briefly the br_bioflat.rb. br_bioflat.rb is an OBDA flat file indexer. OPTIONS
--search Search a database for keywords. --namespace --name Only valid with the --search option. Set the search namespace. You can set this option multiple times to specify more than one namespace. --create Create an index. --location Specify the directory. --dbname Specify the name of the database. --primary --secondary Set the primary and secondarynamespace of the index. Default primary/secondary namespaces depend on the format of the flatfiles. Only valid with the --create option. --add-secondary Add secondary namespaces to the default specification. You can use this option many times. Only valid with the --create option. --update Update an index --sort Sort an index. You can set this to a path to an external sorting program, or BUILTIN to use the builtin sort module. This option is only valid with --create (or --update) and --type flat options. --renew Re-read all flatfiles and update whole index. This option is only valid with the --update option. --show-namespaces Display the namespaces for an index file. AUTHOR
This manual page was written by David Nusinow dnusinow@debian.org for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. BIORUBY(1)
All times are GMT -4. The time now is 04:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy