Android Question Which Database best for my situation

JamesGreaves

Active Member
Licensed User
I have not worked much with databases and need to overcome my fear of them :)
I have and Android app and a Desktop app which needs to connect to a local DB, and sync with an online DB, when Internet is available.
It will need to support Images.
Could anyone advise me please?
 

roberto64

Active Member
Licensed User
Hi, first thing with which DB "sqlite, mysql, etc" however there are many examples in the forum ,.
regards
 

JamesGreaves

Active Member
Licensed User
Yes there are many. I've spent a good deal of time checking them out and getting a bit confused along the way.
I also discovered that some DB connections have kinda made other obsolete.
KVS seamed like a good option, but it's not good for a large databases and images, at least that's what I understood.
jRDC2 also looks good, but ...
Then I thought, why don't I just ask the helpful community.
 

yfleury

Active Member
Licensed User
In the last 10 years, I have make 12-15 web site with php and mysql.
Now with mobile device I work on app for mobile.
sqlite for app only is very good.
Now I work on app and I need to backup database from my app to internet database and back to the app.
I make some search here and the best choice to me is the JRDC2. It a secure transaction between app and internet database because nobody can alter sql request.

I havet to backup images to. Then I dont sent image to database, but I will upload it to web server and save the file name to database.

My jdrc2 server is done, in a few days, I will work to my app.
 

udg

Expert
Licensed User
Using B4A and B4J for your Android and Desktop solutions respectively, each managing a local sqlite db will be straightforward and let you reuse a lot of code and logic.
Then a VPS hosting a major DBMS (MySQL, MariaDB, ..) and JRDC2 (as the middle layer between the remote DB and the Android/Desktop clients) will complete your desired design. Beware about images storage. Generally it's better to store them in a folder and just reference them in the DB.
 

Alexander Stolte

Expert
Licensed User
I like to have everything on a server. Jrdc is nice but you often need much more control (not only db access). So I always use php (security, user signon, device handling, encryption, etc.)
My api is based on jrdc2, i can use it to send push notifications, i upload images to the strorage with it... With Filters i can build security, login, all what you can with php too.
 

JamesGreaves

Active Member
Licensed User
Using B4A and B4J for your Android and Desktop solutions respectively, each managing a local sqlite db will be straightforward and let you reuse a lot of code and logic.
Then a VPS hosting a major DBMS (MySQL, MariaDB, ..) and JRDC2 (as the middle layer between the remote DB and the Android/Desktop clients) will complete your desired design. Beware about images storage. Generally it's better to store them in a folder and just reference them in the DB.
OK, great, thanks. Of course, I'm being stupid, images aren't saved in the DB, just a reference to them. Thank you.
 

JamesGreaves

Active Member
Licensed User
jrdc2 is the suggested Method to work with online Databases. The clients are compatible with all b4x products.
Great thanks Don.
I have an Internet host.

If you have time, please just help me out here, or point me to a tutorial.
I have written a number of apps but never one connected to a DB, and certainly not a remote DB.

Do I first create a DB in Access (or something like it),
Then upload it to the Internet.
Then connect the Android app and Desktop app to it.

Sorry I am so confused!

Must I first connect the app to a local DB?
How do I sync the local and remote app? Do I have a background app which syncs it when a connection is detected?
 

AymanA

Member
Licensed User
Sorry for being a pain, I just need clarity.
Can I use jRDC2 to connect to a local D, when offline, and sync to a remote DB, when online?
I have never tried this, actually I have just created a new VM to try this out as working on similar project, however what I have in mind as a process which has not been tested:

- Check for connectivity, so when it is offline then data is saved to the local DB.
- When there is internet connectivity, then the data that was saved locally shall be sent to the jRDC2 (the middleware) in order to be saved on the DB server (the VM DB server).
- Remove the data from local DB.

For the VM part:

- If you are using a linux VM, then you can install any DB like sqlite, mysql,.. etc
https://www.digitalocean.com/commun...son-of-relational-database-management-systems

- Refer to point number 3 in the jRDC2, you will find that the SQL commands exist in this file, in which it will be passed to the SQL DB that you have created on the VM.

So seems all the SQL statements exist in this file to either create a table or if you already have a table then jRDC2 will pass SQL statements to be sent to the DB behind it.

Experts or anyone has tried this can definitely correct this process if I am mistaken at any point!
 
Last edited:

JamesGreaves

Active Member
Licensed User
I have never tried this, actually I have just created a new VM to try this out as working on similar project, however what I have in mind as a process which has not been tested:

- Check for connectivity, so when it is offline then data is saved to the local DB.
- When there is internet connectivity, then the data that was saved locally shall be sent to the jRDC2 (the middleware) in order to be saved on the DB server (the VM DB server).
- Remove the data from local DB.

For the VM part:

- If you are using a linux VM, then you can install any DB like sqlite, mysql,.. etc
https://www.digitalocean.com/commun...son-of-relational-database-management-systems

- Refer to point number 3 in the jRDC2, you will find that the SQL commands exist in this file, in which it will be passed to the SQL DB that you have created on the VM.

So seems all the SQL statements exist in this file to either create a table or if you already have a table then jRDC2 will pass SQL statements to be sent to the DB behind it.

Experts or anyone has tried this can definitely correct this process if I am mistaken at any point!
Thank you, I appreciate your input.
 
Top