LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-12-2011, 08:16 AM   #1
dchinnodu
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Rep: Reputation: 0
Connect to OracleDatabase through shell script


hi all,
I am the new one of this forum...

Query1:
Actually for executing the sql query in shell script we require uname and password,the same uname and password required for 70 scripts because in 70 scripts i am executing the sql query's. If we using same uname and password in 70 scripts that is repetation problem. I want the solution for once i asked run time uname and password only once these are helpful to all remaining scripts... how it can possible?


Query2:
And for every sql query executing in the each shell script i am connecting to OracleDatabase... I want the solution for connecting only once and using this connection to each and every script... what is the solution for this?

Thanking you,
 
Old 05-12-2011, 10:07 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by dchinnodu View Post
hi all, I am the new one of this forum...

Query1:
Actually for executing the sql query in shell script we require uname and password,the same uname and password required for 70 scripts because in 70 scripts i am executing the sql query's. If we using same uname and password in 70 scripts that is repetation problem. I want the solution for once i asked run time uname and password only once these are helpful to all remaining scripts... how it can possible?

Query2:
And for every sql query executing in the each shell script i am connecting to OracleDatabase... I want the solution for connecting only once and using this connection to each and every script... what is the solution for this?
We are very happy to HELP you with problems, but we are not going to write your scripts for you. Post what you've written, and where you're stuck, and we can assist.

There are many bash scripting tutorials you can easily find with a brief Google search. Hints here are you would use a FOR loop to go through all 70 iterations, and (before ENTERING the loop), you'd connect to the database, and disconnect after the loop completes.
 
Old 05-16-2011, 07:25 AM   #3
dchinnodu
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Hi I am writing the script as bellow model,

echo "Enter Username:"
read -r user
pass=""
password()
{
echo
echo -en "$@"
oldmodes=`stty -g`
stty -echo
read -r pass
stty $oldmodes
echo ""
}

password -en "Enter password:"


the above script model i written in 70 scripts, my problem is asking uname and pswd only once whenever first script run , whenever i run remaining scripts it would not ask againg uname and pswd its take from previous uname and pswd..
 
Old 05-16-2011, 10:11 AM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
This would help you out.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vpn connect/disconnect shell script rashmeepawar Programming 11 10-05-2009 08:15 AM
using telnet to connect to windows server inside a shell script nano2 Programming 3 08-05-2009 12:52 PM
shell script - connect via iwconfig WEP PolarDog Linux - Wireless Networking 3 01-12-2007 01:20 PM
Need Shell Script to allow user to connect to net through terminal Dralnu Linux - Networking 1 05-07-2006 09:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration