Sample code for Database connection

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
r_karAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
mysql << end #invoke mysql and send it a command
select * from database.table;
end
0
 
TintinConnect With a Mentor Commented:
For Oracle, use something like:

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

Specify username/password if you don't have externally authenticated accounts.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.