How to synchronize with PC

aklisiewicz

Active Member
Licensed User
Longtime User
:confused: I have a need to build an App which will synchronize device database with the same SQLite database on PC. I know there are several methods of doing this so I would like to start with the method which will be the easiest (for me) to implement - as I just started with B4A.
I already have a desktop App which connects to SQLite on a PC and I can manipulate records the way I want. One of the methods of synchronization which I was thinking about, is to connect the device through USB (which will be seen as an external drive i.e. E:\), then connect to the database with my desktop program, then run Sync. Obviously device database must have implemented ContentProvider so it can be accessed from another App (I don't know how to do it).
Initially the database will be small (probably 3-5 tables), and I think it is rather irrelevant to the method. My problem is that Basic as well as Android are for me completely new animals, and need a lot to study how to 'pu them on the leash'. :)

Another way would be to access database on the PC (from the device) then do the update (but this seems to be much more complicated).

As third method I would need to synchronize with remote MySQL server, so synchronization will have 3 modes like this:

1) SQLite.Device <--> SQLite.PC (might be initiated either from Device or PC, which ever is easier)
2) SQLite.Device <--> MySQL.Internet (this will be App on device using HTTP services)
3) SQLite.PC <--> MySQL.Internet (this will be desktop App which I'm working on)


I need your advice on how to aproach this , what are possible issues and complications, advantages etc. Most of all I need an easy to implement solution, starting with option (1)

I would appreciate any comments and sugestions.
Thanks - Art

:sign0104:
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Actually ContentProvider is not relevant in this case. ContentProvider allows other internal applications to request data from your application. It cannot be used by a desktop program.

If the database is not expected to be very large then you can connect to your desktop application using the Network library, copy the desktop database to the device and then do the actual merging locally.
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
Thank you for the explanation.

I was hoping if the dB is placed on SD, then I can access it through OLEDB or ODBC from the desktop, when I connect device through USB and map the folder. If you're sure this is impossible, then,..

few more questions though:

I believe it is possible to do the opposite ? For example copy database from the device to the desktop PC, then do the Sync? Once it is on PC I can do the rest, but What needs to be done in order for the database (or I should say physical SQLite file) ) to be available for the PC. another words, if I have my device database located on SD card in some specific folder, would this folder/file be available (for copying) when I connect device to the PC through USB and map it as an external drive ? I've herd some files are not available like this,...that you can simply access it and copy it to HD.
Would it be possible then (after the merge) to copy dB file back to the device ?

I would probably take whichever approach is easier, but the requirement is that all syncing must be bi-directional, so what would you suggest ?

Would this make much more complicated to do this through WiFi connection (or BlueTooth) ?

Arthur
 
Last edited:
Upvote 0

rajaramcomputers

Member
Licensed User
Longtime User
2) SQLite.Device <--> MySQL.Internet (this will be App on device using HTTP services)

By looking in to post and reply I am not sure whether it is possible to communicate SQLite.Device <--> MySQL.Internet (this will be App on device using HTTP services)

If there is any solution please share .. I am also looking for a solution for an application.
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
Ok, so let's say I want my abc.db copied to my local drive C:\XYZ folder,
then later on do oposite operation, how would I that ? Can you give me some hints...please ?

Art
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
well if I use B4A-Bridge to receive file from desktop, I still have to have some kind of an App which allows to do this on the PC so the both ends can talk to each other - right? If so I don't know how the PC part was handled (as I assume it is build into B4A IDE).

On the other hand I just have red your post about new coming Desktop Server. Would this fill the bill ?

Art
 
Upvote 0
Top