SQL block in a Shell Script connecting to a local and remote DB | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

SQL block in a Shell Script connecting to a local and remote DB

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-22-2013
daveu7 daveu7 is offline
Registered User
 
Join Date: Mar 2012
Last Activity: 6 February 2013, 10:17 AM EST
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
SQL block in a Shell Script connecting to a local and remote DB

Hi All,

In a Shell scriipt with a SQL block I want to issue a query against a local DB and a remote DB on a remote server. The shell script is running locally.
This is how I connect to the local server. But I want the query to reference remote table in the join. Question can I specify a localServer.DB and RemoteServerDB in the connection command.


Code:
${MYSQLDIR}/mysql -u ${MYusername} --password=${MYAPASSWD} ${MYSQLDB} << SQL
SELECT col1
FROM localDB.tabl1,
        remoteServer.RemoteDB.tab1
WHERE ......with a join

SQL

Many thanks for your help.

Dave

Moderator's Comments:
Please use code tags next time for your code and data.
Sponsored Links
    #2  
Old 01-22-2013
radoulov's Avatar
radoulov radoulov is online now Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 23 July 2014, 5:33 AM EDT
Location: Варна, България / Milano, Italia
Posts: 5,663
Thanks: 182
Thanked 616 Times in 574 Posts
No, you can't.
With MySQL you can use the federated storage engine to access remote tables from the local instance.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Block local and remote port with iptables - Script BASH houstaf Shell Programming and Scripting 0 03-26-2012 07:03 AM
call shell script from pl/sql block Opamps123 Shell Programming and Scripting 3 12-09-2010 04:01 AM
Executing a shell script from a PL / SQL Block sudhird Shell Programming and Scripting 1 06-21-2010 05:56 AM
error connecting sql through a shell script nehak Shell Programming and Scripting 1 04-30-2008 08:04 AM
Connecting DB in the Shell Script to do SQL Query mehuldoshi UNIX for Advanced & Expert Users 3 03-29-2003 11:47 AM



All times are GMT -4. The time now is 05:42 AM.