Connecting Android, Webservices and database - android

What I'm trying to do is connect a Java Android app with a FireBird database that is stored in an enterprise server.
I realised i need to use some kind of webserver to avoid connecting to the database directly.
In other words, something like this:
Android app -> WebServer -> Database
My problem is that although there are plenty of examples none of them let me do it.
Where can I find a full example of making the webserver, retrieve data (images, datasets, etc.) and how to connect my clients to it.
And obviously if there is a better way to do what I need that I'm not aware of.
Thanks in advance.

Related

How Can I Create a Database Accessed By windows and Android

I have been looking and searching for this whole day, so i want to create a database which can be accessed by both computer and smartphone, is there a way to do it, and how ?
Sorry For Beginner Question, Thanks in Advance
Ok, the first thing you should do is to define the type of database
that you want. You can build SQL or No-SQL database. For the most
part I would suggest no-sql so something like MongoDB could do, but you can always do mySQL. As
for accessing that db with anything actually, you need application
layer around it. You see, database acts as just a huge data
container thus it should not be used for any other logic.
Now, lets talk about application layer. To be more precise - about posting/updating/retrieving data from db. You should research something about RESTApi or GraphQL concepts as they are used to make communication between your app and your db which is hosted on a server (I deliberately did not talk about how you can build an app because I assumed you already know this one).
THE POINT: The most important concept to wrap your head around is how you can access the db you make not the type or tech used to build it. (Even though this is important too)
Good luck!
The better way to do this its creating a web service, so your app will talk to this web service, the web service will talk to your database and retrieve the results to your app (this can be done using HTTP protocol's APIs like Volley for android) and its a secure way to do it.
You can connect your application direct to your database granting external access, but this is a specif configuration according to your database (mysql, ms sql, etc.) and its not recommended.
You can think in the same way to the computer(s) that will access your database, except if this computer(s) is in the same network which the computer that your database is hosted in, in this last case, the program in this computer (which will access the database) can access it directly (you need to setup the database to permit this and this setting is diferent according to your database).

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.

android database to oracle database

Can someone give me an idea or point me in the right direction about following matter:
I need to make android app that will do some things with remote oracle database (take some data, insert some data, ...).
I can do that, but the trick is, app owner needs to be able to do that offline (because he doesn't have internet everywhere), then when user connects to internet, somehow transfer those offline changes in local android database to oracle database.
I never did something like that.Any pointers?
Should I make same database structure in android database like that remote oracle database?Then somehow synchronize changes?
Or is it done some other way?
Thanks for any help.
If you have the ability, it would be best to create a RESTful application on the server that listens for your app to contact it. Then it would take the data (send it from your app via JSON, XML or any of several other popular formats) and operate directly on the Oracle database by doing the adds/inserts/deletes there.
You can do the same thing on the way down - your app contacts the server, the server provides data from the database in the form of JSON, XML, etc and your app can then operate on it's own internal JAVA objects of data.

Which database type is applicable to Android application for contents available in server?

I am trying to develop a real-time Android application where all contents are stored in server. So, they are available whenever a connection to Internet is available. Also, the application provides communication between users and conversations are stored in the server as well. Nothing is locally stored.
However, I am still cannot decide which database type I can use. I intended to use SQLite but I am not sure if I can really use it or not.
Could you please guide me to the proper database type to my application.
Appreciate your time and efforts.
As its upto you which database you use.
you may Install Lamp (For Linux) or WAMP(for window) . This is a nice database tool and very easy to handle and easy linked with PHP for various database function
I recently developed something similar to what you are talking about and here is what I would suggest you to go for.
Use SQL server to manage the data on your desktop and create a web-service in .Net on Visual Studio.
(Note that as others have already mentioned, it really does not matter what is the database you are using in your server end, because eventually the data is going to come to the Android application from the server in form of either xml or json in the web-service., regardless of what database you are using. So it is totally your wish which database you want to use.)
Then connect to the web-service in your application and set/get data from the remote Database, using SOAP.
Link on how to make a web-service in .NET (does not include the implementation in Android).
Links on how to connect your service with Android : this, this and this.

Database over internet

How can I make a database over internet, so I can update the database and all the devices that have the app will get that update to. Am I supposed to use mySQL database for that like in php? =) I have google'd and all that stuff but can't find a good answer.
I hope you know what I mean! Thanks! :)
(Sorry for bad english!)
first you have to decide where you want your data to be stored. You can store them locally on the device or on a server accessible through the Internet. I assume that you want them to be stored centrally through the Internet, in that case you can either connect to the database directly or through an interface. For most of my work I usually put up some scripts to handle HTTP-request (I like using the web technologies) on a server and connect toward this. If you make a PHP or other script you can call this by sending a request for either getting data or setting data.
Your question doesn't make sense. A database isn't inherently tied to the internet. Instead, you have a database on a machine, and provide an interface to it. One way to do this is to do something like write a Rails web interface using a REST based communication mechanism, and then have your apps interface with your database using HTTP requests. This is probably the most commonly done thing, and there are lots of libraries for things like rails, PHP, etc...

Categories

Resources