Android and Connecting to an External Database System (VPS Server)

koeks525

Executive Member
Joined
Jul 14, 2012
Messages
6,011
Reaction score
1,197
Location
Canada
Hi Everyone,

I am working on something fun right now which involves creating an Android mobile app, an ASP.NET MVC website (or a PHP site), and a desktop C# WPF application.

I would love to know how one connects and works with an external database on Android. I heard Android cannot make direct connections to external databases - you would need to have a PHP script on the server.

I got a MySQL server setup on my VPS Server. Would I need to install some web server software (apache / lamp) and host the PHP script(s) on there?

Thanks.
 
You could download a terminal emulator. Then use that to connect.

Otherwise there is an app called servers ultimate pro. Haven't used it fully but it might be able to do what you need.

Or search the play store for mysql. Just did that and a few apps show up.
 
You could download a terminal emulator. Then use that to connect.

Otherwise there is an app called servers ultimate pro. Haven't used it fully but it might be able to do what you need.

Or search the play store for mysql. Just did that and a few apps show up.

I think he wants to build an app that needs to connect to the external DB
 
If you have PHP experience , I would advise you to look at at laravel . Easy to build an API for CRUD operations on a DB, which your android app or any entity can use . Then look a t volley for android to help with API requests.
 
Hi Everyone,

I am working on something fun right now which involves creating an Android mobile app, an ASP.NET MVC website (or a PHP site), and a desktop C# WPF application.

I would love to know how one connects and works with an external database on Android. I heard Android cannot make direct connections to external databases - you would need to have a PHP script on the server.

I got a MySQL server setup on my VPS Server. Would I need to install some web server software (apache / lamp) and host the PHP script(s) on there?

Thanks.
Look up WAMP installations (Window, Apache, MySQL and PHP)

For access here's a basic example:
http://www.tutorialspoint.com/android/android_php_mysql.htm
 
This is a good idea actually.

I am opting in for this

Yes, I have done this a fair bit, so not just speaking from theory and it is working very well. Another thing that I have found is since the Android http client supports compression out of the box without you having to do anything, it can make a significant difference on performance and data bills if your server side system has an option for enabling gzip compression. Hopefully and usually, just as a config setting.

Example links:
http://developer.android.com/reference/java/net/HttpURLConnection.html
http://android-developers.blogspot.co.za/2011/09/androids-http-clients.html (Note, the Apache client has been removed in Android 6.0, so avoid it unless you are only developing for first gen Android devices.)
https://www.playframework.com/documentation/2.4.x/GzipEncoding
 
Top
Sign up to the MyBroadband newsletter
X