Search code examples
javaandroidmysqlstruts

How to access MySQL database with an Android application?


I am new to Struts and Android. We have developed a Struts application. Now, we are looking to develop some modules in Android where same functionalities to be developed. So, it requires a database (MySQL) interaction.

It would be grateful for any ideas. Will it require PHP or Webservices?


Solution

  • It will require web-services,

    You can not access your MySqlSQL/Oracle database from Your application. just because of all of these database are deployed some other environment , and can not deploy huge database like MySQL on a mobile environment.

    So that you need to use web-services for accessing those database(MySQL/Oracle).

    WebServices: Just kind of a mechanism which call some server side script like PHP, ASP, JSP etc. All these script have API for accessing your MySQL database. finally this script will return result in form JSON/XML to your application. through HTTP connection.

    YourAPP ->It Will execute some peace code which talk to your server (Calling web services-> getStudent()-)

    Server -> *It will execute something like getStudent()- "select * from student" - > Budle data into json/xml formet. - > return as response to your App.*

    YourApp -> callback(Student data) -> it will get response.

    Web- Services tutorials