Sync SQLite DB on android studion with MySQL DB on web server - java

I am developing an android app that measures the radio interface parameters of a network periodically, stores the data in SQLite DB and transfers the data stored to MySQL DB on a web server. How can I make this possible?

I've done some research on this and found only one usable option, which is to make a web service using json or xml to pull/push data between the two databases. You could create a database link between the two, but this is not advisable.
There are numerous questions with a more detailed scope for this issue and you should be able to find one that fits your use case. If not, ask a new question after this research with more details and what you've done so far.

Related

Parse.com: Deploy app with local DB

I use the Parse.com Cloud service in my Android app to sync data between devices.
I use the app mainly offline and use the local DB
Parse.enableLocalDatastore(getApplicationContext());
I want to deploy my app with a local DB that already contains a few thousand records. How can I do that? I don't want to sync the data on every device on first use.
Local datastore is not really a "local db", although you get some of the benefits a local db would give you. There is unfortunately no way to pre-populate the local datastore like you're after. The only way I can think of is to use another technology (like sqlite/core data etc) to store the pre-populated data. The problem is that to pin the data to the local datastore, you would need to get the PFObjects from Parse first anyway...
The Parse local datastore is not created to work as an offline database per se; only to offer an "offline mode" for your online data.

What's the best practice when populating a sqlite database with default data?

I'm making an app that will be using few hundred database posts from a sqlite database. I will not be adding new data during the lifetime of the app (unless I update the whole app).
I might end up using a static xml for the data, but I need to flag posts, so I guess a sqlite db would do the job best. I know how to implement it and I've released apps using sqlite before...
But my question is. How to I best populate the sqlite db the first time the app runs? Should I just bring in a file that I use as a resource and then copy to the apps space? What's the best/easiest practice?
The simplest solution is to use SQLiteAssetHelper. You basically drop your SQLite database into your project's assets/ directory, and use SQLiteAssetHelper in lieu of SQLiteOpenHelper. In addition to the sample code up on Jeff Gilfelt's GitHub repo for the library, I have a sample app demonstrating it as well.

Collect Data from DBMS_PIPE using Java

I am currently working on a project where a lot of users will be making changes to our data and that rest of the clients are suppose to see data as soon as it updates. I have implemented web sockets to broadcasting the data the problem is we are using Oracle DBMS_PIPE as whenever data is changed in the DB now I was wondering if there is some api or some documentation which tell how to collect data from DBMS_PIPE using Java. any suggestions?
Thank you
F. Irfan

How to access online mysql database in android?

I have created an online database about the restaurants and I need to access this database through my android application, so that I can display the data to the users after filtering. My application does not need to update the database, but my problem is how to connect to my online mysql database and provide it to the users? I have looked on many suggestions on this site as well as on others, and I just found I have to use JSON parser while accessing but do not how to do it.
The best solution is provide a public API, managed for example with PHP, which delivers your database data filtered and displayed as your Android application needs.
This link might help you . http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
Just get an understanding of JSON parsers and how it can be used in android for retrieving data from database on server... you can write webservices in php..
You need to provide a server side solution that the Android application can speak to. PHP scripts are a good way to go, that can directly interface with the MySQL database, and return results to the device.
You can then be creative with the PHP script, by sorting the results etc, and providing a more comprehensive solution by taking away some of the processing from the Android device, and doing it server side where battery life isn't as much of a problem.
You simply need to implement web service calls on the Android device, simple GET/POST requests over HTTP suffice depending on what you intend to do. Have a look into REST APIs for guidelines on how to implement properly.
You can easily add a PHP script to the same server as the MySQL database for this

SQLite on Google App Engine

Is it possible to use SQLite as a relational database from Google App Engine? (Java) I need read/write access to it from the app itself.
Also, I am using Quercus for PHP, and if what I am asking for is possible, I can handle storing the database myself.
No, it is not possible. This would require write access to the filesystem, which App Engine does not allow.
SQL database support (MySQL like) is planned, but no release data has been given. For now, use the datastore.
I know it's a super old question and nothing concerning read-only properties of App Engine has changed since then... But actually you can use sqlite on Google App Engine. There is a writable /tmp directory (https://cloud.google.com/appengine/docs/standard/java-gen2/using-temp-files). If your app on startup first copies the db.sqlite3 file to /tmp/db.sqlite3 and references this path as database path, it will work.
The following problems are connected with this approach:
This directory is "in-memory". So if you want to use really large sqlite file, you may face problems with RAM.
Each node of the app gets its own copy of the database. If you save something on one node, these changes will not be seen by other nodes. And the new data will be lost if the app scales to 0.

Categories

Resources