Embedded: How?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Taras Kopets

Embedded: How?

Post by Taras Kopets » Sat 05 Feb 2005 12:03

Please tell me how to connect to embedded server, I always get Access violation.. using C++ Builder 6. Could anyone tell me step by step how to do it.
Thanks in advance

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 07 Feb 2005 09:53

Please see Demos/Embedded folder.

PS: What MyDAC and MySQL Embedded Server versions do you use?

ManUtd
Posts: 24
Joined: Thu 20 Oct 2005 02:48

Post by ManUtd » Mon 24 Oct 2005 03:43

Do you have a "Step by Step" help/guide/tutorial" on how to setup the TMyEmbConnection component please ?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 24 Oct 2005 12:57


ManUtd
Posts: 24
Joined: Thu 20 Oct 2005 02:48

Post by ManUtd » Tue 25 Oct 2005 04:04

Just wonder using the Embedded Server how do you make use of the data without copying into the main MySQL Server ?
Note: I assume the PC running the Embedded Server application has no MySQL Server installed.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 25 Oct 2005 09:45

> without copying into the main MySQL Server ?
Do you mean "from the main MySQL Server "? All tables and data stored in MyScript.

ManUtd
Posts: 24
Joined: Thu 20 Oct 2005 02:48

Post by ManUtd » Wed 26 Oct 2005 01:12

I would like to make an update log in my Embedded Server and use this update log to update the main MySQL Server.

Can you tell me how do I turn on the Embedded Server's updat log please ?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 27 Oct 2005 06:24

You can use MyEmbConnection.Params. You can read details about Embedded server parameters in MySQL reference manual.

ManUtd
Posts: 24
Joined: Thu 20 Oct 2005 02:48

Post by ManUtd » Thu 10 Nov 2005 22:59

Is there a standard way/steps to make merge replication/synchronizations between MySQL Server and the embedded server in my application ?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 11 Nov 2005 15:20

MySQL Embedded server does not support replication. So, you should copy data manually.

ManUtd
Posts: 24
Joined: Thu 20 Oct 2005 02:48

Post by ManUtd » Mon 14 Nov 2005 22:46

If the MySQL Embedded Server does not support replication, how do I synchronize the database with more than 1 Embedded Server?

For example, if I have 5 sales persons their notebook have Embedded Server, go to the site and modified the database. We need to synchronize the database one by one when they're back to office.

After the last sales person synchronized the database, the database server got all the updated data.

Then the 5 notebook need to synchronize again to get the final database state.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 15 Nov 2005 09:22

We advise to use timestamp fields to detect changes in row.
To synchronize data use two TMyQuery (MyQuerySrc and MyQueryDst), connected to Embedded and office servers.
In MyQuerySrc execute SELECT * FROM table WHERE c_timestamp > LastSyncDate.
In MyQueryDst execute SELECT * FROM table LIMIT 0, 0
After that just copy data from MyQuerySrc to MyQueryDst.

ManUtd
Posts: 24
Joined: Thu 20 Oct 2005 02:48

Post by ManUtd » Thu 17 Nov 2005 06:27

Hi,

I think yours is the solution to my problem.
BUT could you send me a very simple project that can work for a single table please ?

Especially the last step: how do I copy the data from MyQuerySrc to MyQueryDst ?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 17 Nov 2005 10:24

> BUT could you send me a very simple project that can work for a single table please ?

We don't have samples other than included in the installation package.


> Especially the last step: how do I copy the data from MyQuerySrc to MyQueryDst ?

Use something like this

Code: Select all

while not MyQuerySrc.eof do begin
  MyQueryDst.Append;
  for i := 0 to MyQueryDst.Fields.Count - 1 do
    MyQueryDst.Fields[i].Value := MyQuerySrc.Fields[i].Value;
  MyQueryDst.Post;
  MyQuerySrc.Next;
end;

xchaotic
Posts: 9
Joined: Wed 19 Oct 2005 20:49

Post by xchaotic » Wed 30 Nov 2005 08:12

ManUtd: have you got the project working already?
This is a great feature to have.
My only concern is that time synchronisation is of essence in such a scenario.
I've seen many computers having wrong date, for instance everytime a BIOS is updated or reset it goes back to the bios release date.
So I think it might make sense to incorporate time server synchronisation and another important factor: timezones.
Quite often the system clock is set to local timezone, if the two laptops connect with the same db via Internet, which is imho easy you could force an update of every field to old values if the date or even hour is set to later than the server's.
I think it's fairly reasonable to consider using tags. Every row has primary key, Id field or sth like that, so it should be sufficent to store the list in an SQL table for instance (it could be further optimised to include the type of operation, previous_data and the timestamp or the timestamp can be included in the main table) and only then use the timestamps to update the main db.
The reverse operation should be different as other laptops/nodes might have updated other fields, but tagging on both sides would probably be beneficial.
I might be wrong though as I am a mere beginner in the field, the timestamps might suffice.

Post Reply