Android Question Connecting to remote DB (MySQL) on webhost

Roger C

Active Member
Licensed User
Longtime User
Hi,
I'm new here and been playing around with the free version for a while. Android apps without lerning Java, Great!!! I always wanted to develop apps but been using Basic and VisualBasic for PC for 30 years so this is great!!! Good work!!

Now I'm very close to buying Basic4Android but need to be sure it really works for my planned app and setup... Have been struggling with laptop PC's connecting to databases on webhosts through different solutions, mainly php and wonder if it's easier here...

My idea is basically a setup like this:
Mobile devices will be connected to a central database and users will update their own table in the db, but will take information from shared tables.
The shared tables in the central database will be updated by the administrator at the office either through a webpage or an PC-application. The users tables will also be handled by the administrator.
My app will check if the shared tables have been updated (through a date/time field in a separate table), if so, download information from the shared tables to a local database in the device (SQLite).
User activity in the app will be stored locally too since they don't have internet connection during most of the time at work. A service will check if internet is available and then syncronize the databases from local to central.

Ok, not that difficult...
But I haven't found any really working tutorial about connecting the app to a remote database hosted on a webhost like one.com or equal.
I've found the one with queries through php-scripts, but I've had problems with such setup when using PC's before.
And also the RDC, but what I can see, you need access to the server to install drivers...

Any good advice on how to implement my idea in the best way?
Ie, connect the app to a database on webhost where the db-interface is phpmyadmin.

The easiest might be to actually copy the tables back and forth but it can't be the most elegant?
Also, I might need to actually go inside the db and change something in the future.

Another way is to actually setup an own webserver, but for a start I'd hope to try it out in a smaller setup.

If I must copy the db between app and remote file-server, how do I do that???

Thanks in advance.
:)
 

devlei

Active Member
Licensed User
Longtime User
With your VB background, you can go ahead and purchase B4A - best RAD for Android at a bargain of a price. And what's more, you get a forum like this with really helpful people - you can confidently tackle any task, no matter how difficult.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
First welcome in the b4a-Community, Roger ;)

for the RDC-Examples you have looked. Here i´ve posted a small example using PHP (no matter which provider is used) and a app do little communicating with it.
In that case the given name from the app are returned back to the app which then shows a toastmessage. Really simple.

BUT you can do also MORE complicated PHP-Scripts for sure ;-)

You can use any language on the serverside if you are able to code it. For b4a i used php-scripts for the complete communication from the apps our company is using. But instead of php-scripts i could use a program programmed with Delphi, C++, whatever programm is calleable from outside.

php and a simple (or a better one ;)) webserver is a good and cheap way to let a app communicate with your server.

For B4A i REALLY can say it is worth every single $ and best buy is the Enterprise to get two Years of Updates
 
Upvote 0

Roger C

Active Member
Licensed User
Longtime User
Thank you all!

>Erel. Thanks for your quick respons. You seems to be doing a great job here. :)

>devlei. Thanks, yes so far B4A looks really good. Can't do too much with the free version but it is really easy to work with. Looks very much like VisualBasic. Looking forward to be joining this forum for real soon, there seems to be so many knowledgeable people answering the most stupid questions so I will feel just as home here... on the asking side... :)

<DonManfred. Thanks to you too. :) I will take a closer look at your example tomorrow but it looks promising so far. Thanks again.

Btw, I came across an article in spanish which is based on Erels tutorial about SQL but with added code for inserts, deleting and searching also:
http://iesromerovargas.es/recursos/elec/sol/basic4android25.htm
Ok, I don't know any Spanish but there's Google translate. It always gives you a good laugh but you get the picture what the text says...

Thanks again all. :)
 
Upvote 0

Narayanan

New Member
Licensed User
Longtime User
RDC requires a VPS (or similar) hosting. The PHP solution can work with any hosting. Many developers use it and it works properly without any issues.

If you like you can use a database such as SQLite and download the complete file. This can be done with FTP or HttpUtils2.

Hi Erel,

I have similar question. I have purchased the B4A Enterprise version. I have a PHP program hosted in godaddy hosting and this application interacts with MySQL DB. Now I want to develop some graphs in B4A using the online database content. Can you please advise me a method to do this?

Regards
Narayanan
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
I personally use one of the MySQL libraries and the following link.

https://www.b4x.com/android/forum/threads/workaround-the-networkonmainthread-exception.44760/

The particular library that I use is extremely simple to use and is very fast indeed. Both the RDC and the PHP solutions are not practical solutions for my customers (they do work perfect though). Using a library with the following link works absolutely perfectly for my invoicing, stock control and management solutions and my customers don't have any problems whatsoever, especially now that I have updated those apps to use SDK 21. All my customers are more than happy with the speed and stability of my apps using the MySQL libraries, so I'm definitely more than happy with the solution that I have chosen.

Thanks again for the link above @Erel ...
 
Last edited:
Upvote 0
Top