Embedded: How?
Embedded: How?
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
Thanks in advance
Plase see our answer in http://crlab.com/forums/viewtopic.php?t=2099
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.
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.
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.
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.
> 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
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;
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.
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.