How to download data from different servers?

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 19.07.2014, 20:20

How to download data from different servers?

Postby giulichajari » 24.11.2014, 17:06

I have a datasnap application, i need to take data on mysql databases, i have 3 places with 3 servers, each one in each place, and all of them with its database.
Is a manage app with clients and products. In one moment the boss need the information (for example) about the debt of a client, obviously i have to make a query for example in the 3 servers, because client probably buy products in different places.

My idea is having a unit in delphi XE2, and take the parameters (IP,Port,User,etc) from an .INI file, obviously each one per server i had added. Wich componnents i will need in order to specify every server i had installed from the .INI? I was reading about ZGroupedConnection. I know i have to make for example:

Code: Select all

Select tickets from ticket where idcliente=:idc
where idc is the client that boss need information about.

I would execute this query in each connection because the db is the same in each server. At that point i need a Zquery.

But my question is how to go proving with one server and then other and then other...

User avatar
Zeos Dev Team
Zeos Dev Team
Posts: 132
Joined: 26.08.2005, 08:12
Location: Cancún

Re: How to download data from different servers?

Postby fduenas » 03.06.2015, 12:00

I dont know its a little bit late.

But if all your servers are mysql, why dont use the 'servers' feature of mysql and the 'FEDERATED' table engine . With that you can register external mysql servers that can be accessed by a main one creating a table of type 'Federated' which its data will always come from a remote server:


So all the process can be done at mysql server side, maybe inside a stored procedure that can lookup into the servers.

TIP: to speedup your search I always recommend to assign a unique ID identifier of the server to the records inserted in that server, in this case it could be '01' for server '01' anmd the consecutive ID,m, for example the client '020' that is located at the server '01', the complete client ID can be '01-020', so when you call the stored procedure you can parse that ID and you will know in what server to lookup.

Return to “MySQL”

Who is online

Users browsing this forum: No registered users and 1 guest