Copying data from a MySQL server to an embedded LOCAL instance

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
[email protected]
Posts: 6
Joined: Tue 08 Nov 2005 15:58

Copying data from a MySQL server to an embedded LOCAL instance

Post by [email protected] » Wed 04 Jul 2007 09:31

Hi,

Can anyone suggest the most efficient way to copy all data from the MySQL server to an embedded LOCAL instance so that users can work with the application off line

thanks in advance for any ideas.

regards

Mark

saidus
Posts: 78
Joined: Wed 26 Oct 2005 09:54
Location: Algeria

Post by saidus » Wed 04 Jul 2007 14:46

Hi !!
you may dump the Database on the server (import DDL statments) the recreate all objects in local ...
you can use the TMyDump or directelly with mysqldump.exe

[email protected]
Posts: 6
Joined: Tue 08 Nov 2005 15:58

Post by [email protected] » Wed 04 Jul 2007 14:58

saidus wrote:Hi !!
you may dump the Database on the server (import DDL statments) the recreate all objects in local ...
you can use the TMyDump or directelly with mysqldump.exe
Hi,

What I need is the DB, tables and data or a direct copy of data from the server to an embedded instance on the users LOCAL system and I don't beleive MyDump is appropriate. Assuming the Local DB structure already exisits but the tables are empty or its a completly empty DB I either wish to copy all data across form the MySQL system to the LOCAL embedded DB table by table but efficiently or create DB, Create tables and then transfer the data. Hope that makes sence. What I currently do is basically clear the local table and then copy the MySQL server data (LAN data) table by table , row by row to the LOCAL embedded instance. I don't think this is the most efficient way to be honest asn was hoping for suggestions on a better solution.

regards

Mark

saidus
Posts: 78
Joined: Wed 26 Oct 2005 09:54
Location: Algeria

Post by saidus » Wed 04 Jul 2007 15:12

you can use mysqldymp.exe

Code: Select all

mysqldump --database dbname > a.sql
then when you get this file "a.sql" you pass it to your local server to recreate all database
like this

Code: Select all

mysql> \. a.sql
(in local)
:lol:
or you can recreate all the structure of your net dbase then import only data
finally you inject tha hole data in your local DB[/quote]

[email protected]
Posts: 6
Joined: Tue 08 Nov 2005 15:58

Post by [email protected] » Wed 04 Jul 2007 15:22

saidus wrote:you can use mysqldymp.exe

Code: Select all

mysqldump --database dbname > a.sql
then when you get this file "a.sql" you pass it to your local server to recreate all database
like this

Code: Select all

mysql> \. a.sql
(in local)
:lol:
or you can recreate all the structure of your net dbase then import only data
finally you inject tha hole data in your local DB
[/quote]

Hi,

thanks for the reply. However your suggestion relies upon command prompt exe and the synchronising to the LOCAL embedded DB needs to be on the fly such that a user needs the most up to date copy now to take away to walk on client site for example so he runs a syncronising application which copied all the data from the MySQL server tables to the LOCAL Embedded DB to take away. Any subsequent requests for a LOCAL copy of the data will also need to be on the fly as passwords and the like are constantly changing so the application must be able to sync the Embedded DB with the MYSQL DB dynamically whenever requested and get the most upto date copy of the data.

regards

Mark

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 05 Jul 2007 07:07

You can try to use the TCRBatchMove component to synchronize data in tables of two databases.

Post Reply