I am writing an application for my third year project. The application will require interaction with an external mySQL database. The application will retrieve data from the database and display it to the user in a ListView.
I have a good idea of what sort of functionality the application is going to have. I also have spent a lot of time working with ListViews and the local SQLite database. I also did a bit of reserach into the HttpUrlConnection class.
I am just wondering would anyone be able to offer me a little bit more guidance as to how I might go about accessing this external database?
Will it involve me having to write a web service to handle the transactions? and if so what would that involve as I have not encountered web services in my course just yet.
Any advice would be much appreciated. Also my application is intended for use on ICS v4.0.4.
Thanks everyone!
Applications get a database connection from a connection pool by looking up a data source using the Java Naming and Directory Interface (JNDI) and then requesting a connection. The connection pool associated with the data source provides the connection for the application.
Android does not support MySQL out of the box. The "normal" way to access your database would be to put a Restful server in front of it and use the HTTPS protocol to connect to the Restful front end.
Yes you have to create Web Service to interact with External Database (MySql in your case). Its very easy to create Web service in PHP as its having one function which convert your DB data to JSON and you can easily parse the JSON data and display that in Listview or accordingly your requirement.
Here are some useful link which will help you to get more details :-
http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ - Best from All
http://www.coderzheaven.com/2011/04/08/android-phpmysql-connection/
http://blog.sptechnolab.com/2011/02/10/android/android-connecting-to-mysql-using-php/
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With