Is MySQL a Network Database? - android

I want to insert, update, show records from an android app to a database (online) which will be installed on an android mobile.
So,my question is; which database is perfect?
MySQL
SQLite3
Any other

It's impossible to use MySQL in Android. Other SQL types neither. The best way is to use a MySQL database and get the information via PHP. Encode it to JSON in PHP. You can get the Web page in Android and decode it in Android.

Is mysql db is network database
MySQL (like many other database servers including Postgres and Oracle) can be accessed either through a local socket or via TCP/IP. (You also mentioned SQLite, this is a file based database and does not have a network server AFAIK).
There may be libraries for Android that implement a MySQL client, but a few minutes with Google didn't turn any up for me.
Generally speaking, network access to MySQL should be limited to private networks and not end clients anyway.
If you want to access a database from a client application over a network, you are usually better off by building an HTTP based API (preferably one that is RESTful) and letting the client software connect to that. This gives you more control over what clients are allowed to do with the database.
You can build such an API in just about any language you like. If you are working with Android, you might prefer Java. My preference would be Perl. Python is a good option, etc, etc.
which database is perfect?
Nothing is perfect. Giving a recommendation for a specific database would be drifting into "Not Constructive" territory, even if you were more specific about your requirements.

Related

android auto sync mysql to sqlite [duplicate]

I am developing an android application. I want to update the local SQLite database with MySQL database on server. I am not able to figure out that what is the most appropriate and standardized way to do so?
Create a webservice (REST is probably best) and serialize your SQLite/MySQL data and PUT/POST/GET it to/from your web service. This will give you a nice layer of abstraction in case you decide to switch from MySQL to something else server side.
You may want to take a look at fyrecloud.com/amsler This is source code for a demonstration Android application that implements MySQL replication between a MySQL server and the SQLite db on an Android device.
Amsler rests on two pillars:
It communicates with the MySQL server using the MySQL Client/Server protocol in order to connect to the server for authentication and for receiving replication events as they occur.
It uses the Antlr lex and parse software in order to lex and parse incoming replication events and then to translate the MySQL commands into equivalent SQLite commands.
This is great for one-way replication. You can simulate two-way replication by modifying the MySQL server indirectly via RESTful type methods and then watching while MySQL sends a new replication event back.
Accessing a server via REST is easy enough. However, modifying an existing MySQL installation in order to support serialization presents too many headaches to enumerate here. Amsler takes advantage of pre-existing replication services. REST also depends upon some polling strategy in order to keep the local device reasonably up-to-date. Again, many problems with this approach. Amsler maintains a TCP/IP connection to the server which enables server-push notification of updates.
The most difficult part of Amsler is in figuring out the lexing/parsing. The Syntax between MySQL, SQLite, and the various versions of the same have many subtle differences. So many differences that it's impractical to provide a shrink-wrap translator and instead you must resort to modifying the grammar yourself.
Nevertheless, good, bad, or ugly, here it is. Take a look and maybe the glove fits.
This is probably going to be helpful: sync databases Mysql SQLite
The real answer is that there is no standard or built in magic way to just copy a MySQL database that lives on a server somewhere to a device. You will have to implement either a webservice or somehow convert the MySQL db on the server to the android sqlite implementation and download that file into your app's data directory (not a route I'd recommend taking).
Late to the party, but http://www.symmetricds.org/ is a good solution.
Java, runs on Android too.
LGPL.
Can handle 10,000's of clients.
There is no standard way. Depending on your needs you can e.g. use webservices in REST or SOAP protocols or more binary data exchange.

Setting up a local server for SQLite database - Android

I've created a pre-made database in SQLite for an Android app I'm developing. The app should interact and pull data from the database and display it on different 'Intents'. For now I just want to set up a local server on my Windows Computer for the database.
I was wondering what is the best way of doing so? I have little to no experience with setting up local servers or anything with regards to servers.
Thanks for any help!
There is no such thing as an SQLite "server". SQLite runs locally only through libraries. Also, Android database connections can not simply connect to anything on a server.
If you need a database on a server and an Android client to manipulate the data, you need to implement some kind of client-server architecture, for example using (RESTful) WEB services or any other client-server-communication.

How to connect android to MySql database server?

In my project, I have to connect an Android mobile phone to a remote MySQL database server, to insert data to the database and get the data back later.
However, it seems that Android OS only supports the SQLLite database that works LOCALLY inside the phone.
Does anyone know how to connect an Android phone to a remote MySQL (or MSSQL, or Oracle) database server ?
Thank you!
You will have to access the database using some sort of Remote Method Invocation (RMI).
My personal recommendation is to create a RESTful HTTP interface to your MySQL database on the server. This may be a bit more work, but is preferred for its ease of use and compatibility with any system (that can make an HTTP request that is).
Essentially, you should create HTTP endpoints to Create, Read, Update, Delete (CRUD) data from your MySQL database on your server. Your Android client would then make calls to these HTTP endpoints to perform the corresponding CRUD operations. Of course you do not need to do the typical CRUD operations, you can make your endpoints interact with the database however you wish.
Like I said, a big advantage to this is how extensible it is. You can create another client, on another system, in another language, and all you need to do is make the proper HTTP call.
try using Jdbc... for more read this http://developer.android.com/reference/java/sql/package-summary.html

Android: Connect to Oracle database via username and password and present data from the database to user?

I'm developing a web app with Java Servlets that can access an oracle database through the Tomcat server. I am also developing an android app that I want to use to be able to display the information that is stored on this database, so I will need to provide the user with the ability to log on and access the data from the database. The information will then also have GPS coordinates to display the items on a map.
Any ideas of the method or process involved in achieving something like this? Thank you!!
One really easy way to solve this problem involves using another product from Oracle, Database Mobile Server.
Having your Android devices connect to Oracle Database over the network has serious security and other implications.
Instead, you can just use the local SQLite database that is built into Android. Database Mobile Server provides a sync client that runs on each Android device, and synchronizes the local database with the remote Oracle Database in the background.
You can read more about the product and download an eval copy here:
http://bit.ly/tLjaF7
Good luck with your project.
Regards
Eric, Oracle PM

Connecting Mysql with Android

I am new for Android Development. Now I want to connect Mysql with Android Application for uploading data to the server. Please send any sample code for connecting mysql with Android.
There is no MySQL connection library for Android that I'm aware of, unless you can get the MySQL java library operational under Android.
Either way, you don't want to do this - that would mean exposing your MySQL server to the world for TCP connections. There's no way to tell what IP your device will be appearing from. Each mobile carrier has their own internet gateway for devices, and it's invariably a NAT firewall to boot. This would be require you to leave MySQL wide open to TCP connections from all IPs, a major security hole.
Instead, you should build up a web service that acts as a middleman between your app and MySQL.
You can use MySql to connect to your android application through a servlet using Apache Tomcat. You will have to put your SQL syntax into the servlet you created and in your Java insert the URI path for the servlet.
i believe you need apache tomcat to run a servlet for your sql, do you have it?
The way it should work is , you use the sql-lite database to store the data that is generated in your application.Then, when you have a fixed set of data,convert into a protocol buffer, transmit the same via web-services,depacket it and store into a mysql database at the server.
If you need to manage data in a private database, use the android.database.sqlite classes.
Not sure if android supports mysql.
Go through the Notepad Tutorial for information on connecting to sqllite
http://developer.android.com/resources/tutorials/notepad/index.html
Other than sqlite we can't connect with any other database.
Using sqlite is also not a good practice, better use web service calls.
It is because, some viewers will be having less memory phones, has we are doing the application global, we should think of these things.
For small requirements you can use sqlite.

Categories

Resources