Reputation: 505
I need to store data on a SQL on the localserver(for now) from an Android application. I wanted to know how this can be done? I have read about "having to use a web service like php for the job" and "google app engine" but have not yet clearly understood the whole process/concept. It would be amazing if anyone out there could provide me start to end tutorials on developing a simple app mentioned below.
An app which has a text input box and when the user enters the message and clicks send the message should be stored in the local server database. Another button called listener which will take the message from the database and show it on the screen.
If you give me guidelines on how to develop the app above it wud be really great.
Upvotes: 0
Views: 1622
Reputation: 1973
You definitely want a middle layer out there between the internet and your mySql database. It would be very foolish to allow something from the internet to directly connect into your DB, even if on a limited user.
My suggestion:
HttpClient
in android, POST to them your username/pw for the limited user acct. You can be even more cautious with security here if you want.This is also pretty close to RESTful web implementation, which is nice in it's own right and will make life easier down the road ;)
Upvotes: 1
Reputation: 5542
If you want the database to be on the handset use SQLite, take a look at the link, it covers setting up a SQLite database then importing it into your project:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Once you have the database helper up and running you can create your own methods to insert/extract/edit data to/from the tables withing the db, this link cover the syntax of the queries:
http://www.firstsql.com/tutor.htm
Hope this helps, it might not quite be what you want!
Upvotes: 0
Reputation: 12636
Having database port exposed in internet is stupid idea because:
In your case you should write web service (JSON i.e.) in one of your favorite language. Service is barely saying internet application without any pages. This service should expose method like this:
public void storeName(String name);
In android client you call service and pass to them parameter entered by app user. Service when called just inserts parameter into database.
Upvotes: 3