Mysql data on remote server access on android device - android

I am developing an app which has database in Mysql in remote server .I Want to access the data from my android device . My access of data does not require to modify the data it just should be able to check the database .
1)Will I need the Web Services for this ?
2)If yes please help which web services , I really confused by looking at Soap,RESTful webservices.
Thanks in advance.

Yes obviously you must need to use web service to get the data from server. Better to use JSON data transfer format for that and we call it as Restful service as well. A very simple tutorial for that http://www.vogella.com/tutorials/AndroidJSON/article.html

Related

Accessing data from Local MySQL Server from Ubuntu in Android

I want to install MySQL on my Server and create a database and access my database through my Android Code. I know that this work can be done through webservice in Android, is there any way that I can use it without webservice. I don't find anything related to this. Please provide any links useful for this kind of work.
Yes you can write one restful web-service which will interact with your MySql database, and then you can integrate the service with your android code.
To connect your java code to MySql, you can simply use JDBC or hibernate.
To integrate and consume the restful web service, you can use spring-android-rest-template(to call web service) and jackson-databind(to get responce in JSON format)jars. You should read once this link. I have also used the same for my android app, and It is working.
Its really easy to learn and use.
It will take hardly 30 min. to understand it.
https://spring.io/guides/gs/consuming-rest-android/

Connect android app to wamp

I want to insert the data in mysql from android. I use php webservice for transfer the data.
Which url is used to transfer the data? Which method is used for android webservice?
Not Possible as best as i know android. You need use PHP or J2EE running as your using already Wamp, and expose as apis.

querying online database of free server via android app

I am creating an app which queries an online database. I am using a mySql db hosted on a free web server. Can I create web services on free servers? Also can I query a database from my app directly without using web services?
as RED_ has stated, you need Http POST to query your database. For the answer for free web server is Yes you can.
You can create some PHP file to execute and query specific functions Such as select and display list on your android App.
As far as i know, You are NOT able to query database directly and you need gateway to do this. what i mean gateway is some files that bridging your app and the server's db. This gateway can send and receive JSON or XML objects then your android app can consume it.
Some good tutorial to begin with:
http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
or call webservice in android
http://androidexample.com/WEBSERVICE/index.php?view=examplecloud&scat=26
if you need more detailed description, just create another question thread.
hope this helps.
From what I understand you need a .php file on the server that you will Http post to. That will talk to the MySQL database and return the information. This may not be 100% accurate but I tried it on a small local server and it worked. You cannot directly talk to a MYSQL database from my understanding.
What else have you tried so far?
No you cant query the database from android with out some webservice or some sort of application that will be in the middle between the android application and the database .
and you can create a web service in your free host
Hope that Helps

Android SQLite to My MySQL Web Server?

I have been learning SQLite on Android and have done some tutorials on how to use it.
There is a question that I want to ask.
Is there a way to make my app connect to my MySQL database in a remote web server of mine so that it can read data and also write data to the database?
From what I've researched, SQLite cannot be used remotely and I would need some kind of Web service in between?
It's not easy to create a connection to MySQL from Android, if it's not impossible. With that, it's also not safe if for example someone decompiles your app they have access to your whole MySQL database if you don't limit it enough.
For those reasons, you can better use a (for example) PHP webservice to which the Android application sends all their requests. An example is available at http://www.helloandroid.com/tutorials/connecting-mysql-database.
I also suggest you use Android Asynchronous Http Client so you don't have to deal with connectivity issues and AsyncTasks yourself.
You can refer to this tutorial but you do need a web-server for it.
Request mechanism
Android App ----> webserver ------> database (mysql)
Respond mechanism
Android App <---- webserver <------ database (mysql)
Android App will use JSON or other to get the data and display it
You have to use Sqlite database and web Services both. First you have to save the data in local database i.e. SQLite database and then send this data to your server using web services and vice versa.
this link for web services
and this link for SQlite will help you understand.
Thanks.

How to get data from a database and update it in app in android?

Ok i need my app to retrieve data from a DB and display it in my app, i know this can be done using XML/JSON parsing but the data is to be updated almost daily so updating XML file wont be a possibility. The server uses SQL DB, so is there any other way other than Parsing data from it? I have heard about web service getting data n returning it to the app but in my case will it work? Will ibe able to retrieve specific data i need from the server?
Thank you
Yes. You need to create one web service and deploy it on your server which query the database and return the response in JSON/XML format and then parse that response and update your app's data. That's the straight simple way.
As you said you need to do this daily, you can think of creating a Service for the task and might be you can use AlarmManager too.
Yes you can refer this link
Android (Java) Simple Send and recieve with Server - Fast Setup Challenge
Sending and receiving data from a web service using android
simple client server communication in android

Categories

Resources