I am developing an app for android which needs to connect to a database. For development purposes, I want to set it up on my local computer(Mac OSX El Capitan), I have already set up the localhost web server, I just don't know how to add a database to it, and access the elements through a web layer.
You'll probably want a database server also. You could use XAMPP for the webserver and the database server. Then you could use PHP to access the database and display the values on the website
Related
I have created an android application that retrieves data from my database in the localhost but i want to be able to have the database online and retrieve the data from there. That way i will just need to have a regular internet connection and it will connect to the database and get the data into the android application
To retrieve data over internet world wide. You will need to a hosting or static IP.
Hosting
There are mostly two types of hosting available.
windows (provides Windows server with ASP, ASP.NET, MS SQL)
Linux (provides Linux server with MySQL and PHP)
static IP
Make you computer as server configure it on static IP. Then you can access your PC from anywhere. just type your IP replacing localhost in your web service.
I've created a pre-made database in SQLite for an Android app I'm developing. The app should interact and pull data from the database and display it on different 'Intents'. For now I just want to set up a local server on my Windows Computer for the database.
I was wondering what is the best way of doing so? I have little to no experience with setting up local servers or anything with regards to servers.
Thanks for any help!
There is no such thing as an SQLite "server". SQLite runs locally only through libraries. Also, Android database connections can not simply connect to anything on a server.
If you need a database on a server and an Android client to manipulate the data, you need to implement some kind of client-server architecture, for example using (RESTful) WEB services or any other client-server-communication.
How can I connect MySQL and Android?
I have MySQL db in remote I want get the values from that database and display those content in Androidlist view. I have tried many web service samples, but I have met some problems.
I have tried this using json and php from this link http://blog.sptechnolab.com/2011/02/10/android/android-connecting-to-mysql-using-php/ , but my app quits
There is no JDBC driver for android / MySQL. So you can't connect to your database as a desktop application or a web server would.
You then have to write a small interface, typically a web server to make your mysql data available, and then write a small android client, usually parsing xml stuff from your server.
That's the way to go, the very big picture, but your question is vast and fuzzy, that's the best answer I can give you.
There are various way to access mysql database from android.
You can access data from web services for ksoap2-android lib is good fro that. Click for web services example web-services example
You can also use Http connection or socket programming.
This have been repeatedly in SO, here a i leave you with some samples
SO
Connect MySQL database from Android
Get data to android app from mysql server
How to connect to a MySQL Database from an Android App?
android remote database connection trouble
mysql db connection
Connect MySQL database from Android
And also in other places,
AndDev
[TUTORIAL] Connecting to MySQL database
HELP with a Tutorial for connection using MySql
More
But wait there is more :D, on google
I'm developing an application in android. I use an sqlite3 database. But I need to implement in mysql database using wamp server.
You'll have to use PHP scripts which handle all the database things on your WAMP.
This script will react as a bridge between your MySql and Android.
After this, make network requests to this script from your Android device and get data returned by the database.
You must understand that MySql isn't available to Android devices locally, thus you can't access it the way you access sqlite on a device. To get this, you'll have to implement something like a webservice.
I've been looking for a week now... I need some help connecting to a remote database... I want my app to get data out of the database and update the database...
I've tried this but i don't understand it.
Easiest way to connect a Mobile (ANDROID, iPhone, Symbian, WP7, you name it) device to a Data Base is to write a HTTP based proxy for your database.
This is:
ANDROID -> HTTP -> APPLICATION SERVER -> DATABASE
And then the other way around to get results:
DATABASE -> APPLICATION SERVER -> HTTP -> ANDROID
In this scenario, you will write a HTTP based application in your favorite language (PHP, Python, Perl, Java, .NET) and deploy it in your favorite Application Server (Apache, Tomcat, IIS) and, in that application you will publish URLs your Android app will access to send/retrieve data to your database.
I think rather than connect to a database remotely, you want to use REST services to get and post data to your remote database.
You can create a REST service to wrap your remote database query and return via http, JSON (which I prefer) or XML.
In your android app you can do an http get or post to consume the aforementioned service
Create the database in the server
Write server side program to store and retrieve data
write the android program to access the data using HttpPost class
All the best...