Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i use PostgreSQL or mySQL in android App development

Tags:

android

i am new to android development. i am developing an android app for a university management system. Can i establish connection with database like postgreSQL or MySQL in android.?If yes how?. Also, Can some one provide me with a link to find source code of similar applications

like image 947
Sanoop S Avatar asked Apr 25 '14 16:04

Sanoop S


People also ask

Can I use PostgreSQL on Android?

There is no PostgreSQL port for Android. PostgreSQL cannot be compiled for Android.

Which database is best for Android app development?

PostgreSQL. A unique relational database, PostgreSQL is the best database for Android and iOS apps. Developers can customize this database as they want; that's why it's the most preferred mobile app database.

Is MySQL good for app development?

For applications that require high availability, security and support complex queries to search for relational data whose structure will not change over time, MySQL is the obvious choice for any application that will benefit from its pre-defined structure and pre-set schemas for data integrity.


2 Answers

You have three main choices:

Direct connection to database

You can connect the devices directly to your database with JDBC driver.

http://www.basic4ppc.com/android/forum/threads/connect-android-to-mysql-database-tutorial.8339/

This is not your best choice if you want to maximize the security of your system.

Web services

You could deploy a REST service on a server that connects to your database, and the android app should communicate with this service if you want to make any operation (read, write, update, delete) in your database.

You have a lot of tutorials about how to deploy REST web services in your fav language/framework.

DJANGO = http://www.django-rest-framework.org/tutorial/1-serialization

NODE = https://github.com/mcavage/node-restify

RAILS = http://old.thoughtsincomputation.com/posts/understanding-rest-in-rails-3

This is the most commonly used stack for android apps that needs database. Next, you have a nice tutorial here for how to connect to REST service via Android:

http://blog.strikeiron.com/bid/73189/Integrate-a-REST-API-into-Android-Application-in-less-than-15-minutes

Local database

Maybe is not what you want, but you can access to local SQLite database in your app. You can deploy your apk with the database asset inside or just download the database file from a server

Hope it helps!

like image 156
gyss Avatar answered Oct 27 '22 00:10

gyss


Android has an inbuilt sqlite database that you can use within your app. You can also access virtually any other database system via an API.Have a look at this link http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ and http://www.tutorialspoint.com/android/android_php_mysql.htm

like image 36
mungaih pk Avatar answered Oct 27 '22 00:10

mungaih pk