Solved

Sample code for Database connection

Posted on 2007-04-06
4
1,683 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
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
powershell backup 2 125
Get a Perl script to return content from a module 7 80
EXCHANGE 2007, SCRIPTS 67 79
SCP a file to multiple machines using a script 4 45
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 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