Solved

Sample code for Database connection

Posted on 2007-04-06
4
1,688 Views
Last Modified: 2013-12-26
Hi all,

Can anyone please post sample code for database connection (Oracle or MySQL) using Shell Script.
Please add comment for the scripts, so that I can easily understand the script.

Thanks
0
Comment
Question by:r_kar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
ID: 18873546
mysql << end #invoke mysql and send it a command
select * from database.table;
end
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 35 total points
ID: 18879439
For Oracle, use something like:

sqlplus -s / <<EOF
select .....
exit;
EOF

Specify username/password if you don't have externally authenticated accounts.
0
 
LVL 1

Assisted Solution

by:sureshp
sureshp earned 40 total points
ID: 19017035
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question