Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


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 !!

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-22-2013
Registered User
 
Join Date: Mar 2012
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
--
 
Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 5,468
Thanks: 139
Thanked 538 Times in 506 Posts
No, you can't.
With MySQL you can use the federated storage engine to access remote tables from the local instance.
Sponsored Links
Reply

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 08:55 PM.