0

I want to connect a mobile application (Android) with MySQL restful web service to do the following

1- save the data of the client user (Android Mobile Application) to MySQL Restful data base
which is:-

a- User Login (User Name & Password).

b- Location of the mobile (Longitude & Latitude).

i have already created the restful web service linked with MySQL Data Base and created

attributes in the Database table (ID , User Name , Password , Longitude , Latitude)

i want to know 1- how to connect the client (the android mobile) with the rest and 2- how

to fill the database with the info coming from the client ??

Thanks in advance

4
  • This is IMHO not an Android question. It's a general Java networking question, since Android uses java.net.* etc. Commented May 6, 2012 at 14:49
  • you mean i should remove the android tag ? Commented May 6, 2012 at 14:53
  • I wrote my comment before you added the Java tag. And, since you are not specific enough about your web service, I can only give a general advice to use java.net.* classes for communication. Commented May 6, 2012 at 15:03
  • i would be great i am welcoming that of-course :D Commented May 6, 2012 at 15:13

1 Answer 1

1

This questions has a huge scope, and is not really a suitable question as you'll need to go away and learn several different technologies, make some design choices and choose some tools. I'm going to give you a few pointers.

First you'll need to decide on your server environment, Tomcat uses a Java web container so could be a good choice, but it's going to depend on the server you're hosting on. Then you are going to need to write a program that you'll install on the server that will provide you with a HTTP interface to your MySQL database (your API).

If you want something that's going to be of minimal effort, start with something like Grails (Groovy on rails). Grails programmes can be written in (Java based dynamic language) Groovy, or in Java, Groovy is quite straight forward to learn. Grails will build you a framework from your domain objects (ie the objects that translate into the tables in your database) and provide you with basic CRUD functionality that can be accessed by RESTful HTTP calls (once the program is running on a live server). So data can be passed from the device by using a HTTP POST method, and grails will take care of handling the data and saving it into the database, the reverse for retrieving information is also true.

That should give you a basic overview, I'd suggest starting by downloading Tomcat, and get a virtual server running on your machine.

http://tomcat.apache.org/

And downloading Grails

http://grails.org/

and going through books and tutorials. There is loads online you can google so I won't list them here, but hopefully this should help you get started. Good luck :)

Sign up to request clarification or add additional context in comments.

5 Comments

thanks for reply :) , but why tomcat and grails , and why not that environment i am using ? and i cant find the answer in tutorials like this which i started with netbeans.org/kb/docs/websvc/rest.html
ahh apologies, I didn't see that you had already made the web service!
To pass data from the Android mobile to your web service, you should just use HTTP GET/POST calls, I'm not sure in your specific case how you would connect the web serice with the MySQL database though
you scared me :D , i have been searching a whole week about this , and spent time choosing between rest and tomcat and others , i still not got at all , but i thought that i will start all over again :D :D
i connected the MySQL already put for (ex) i want to fill that MySQL with info how could i do this , how to post,get,put ? would that be in the test page or i should code inside the get, post put methods in the rest classes ? any tutorials or books for that ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.