How to transfer SQLite db to web server on android phone - android

I have an application that creates an SQLite database and saves
information to it over the course of a day. At the end of the day i
want to export this database to a web server.
Could anyone point me in the right direction for this?
Should I use httppost or put. I have researched this myself online but
there seems to be so many different ways to explore. The server side
does not exist yet either. I have access to an apache server so i am
hoping to use that.
Could anyone advise me the best/most simple way to do this?

Thanks guys,
Just wanted to let you know that i used the intent provided by the andFTP app in the end. Its very simple to use and details can be found at: http://www.lysesoft.com/support/forums/viewtopic.php?f=5&t=158

Couple of ways ...
you can ftp up the db each day
you can export the data to a csv file and post it to the server; once there you can then import it into the db on the web server
Is it for backup purposes? Or do you require a number of dbs on the web server?

Do you want this to be an automatic or manual transfer? SQLite data is just a file, so (from the SQLite site)... "If SQLite can read the disk file then it can read anything in the database. If the disk file and its directory are writable, then SQLite can change anything in the database. Database files can easily be copied onto a USB memory stick or emailed for sharing." So (provided everything your app needs is set up on the server) just move the file to the server.

Related

Where to find database connections in an Android App

New to Android app building. I built our company website using php/mysql and my boss had an android app built previously with, I assume SQLlite, or something. Anyway, he wants me to change the database that it's currently linked with to our mysql db. For the life of me I cannot find anything even resembling a connection string or a query in the file system? In my attached screenshot where would I find this information? Or is it not held in this tree at all?
I would assume the data/model folders, but I've searched every single file in those folders. I really need some help.
SQLite is a local db. There would be no connection string, its literally accessed as part of your process.
You should NOT directly connect to a remote db. Doing so is completely insecure, as it would be putting the password for your db into the app. You need to run a web service, and hit that to get your data. The web service then connects to the db.
You should also probably figure out what the actual project is. With SQLite, you would work offline, based off a copy of the data stored locally. With a remote db, offline use is impossible. Being told to replace SQLite with a remote db and your level of understanding of that in this question shows that one or both of you don't understand what the scope of that change is, and you should make sure you're on the same page and what the best way to achieve the actual goal of your project is.

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.

storing sqlite database online

Previously, I developed an application with an internal sqlite database stored.
Now I need to upload that database in an online server so that admins can easily modify the contents.
Is it possible for my app to access/use the sqlite database online?
The application is done on both ios and android.
For iOS it is not possible to access an online database. You should send the data to a server side script like php and from there parse it into your database. Only need to recreate your database format on the server end.
Or export the database as a file and import it on your server with something like phpMyAdmin or something. It can import all different kinds of formats like .sql, .csv, .txt.. Whatever you like.
Good luck!
Hmm, after rereading I think you ask the question if the app is able to use the database from an online source after importing it there? Am I correct?
Simple answer.. for iOS. No. You have to return results to the app by using a POST or GET request.

Backup/Restore database file from device to website?

I've done a small school project to manage a library with several books, using SQLite and android 2.2. Later on, they asked me to create a back office system, which I wasn't ready for. So I'm trying to achieve a simple backup system that connects to the internet.
I would like directions or hints to:
Get the project database from data/data/package_name/databases/school
Send it to a online repository, could be just a ftp connection to upload school_%date% and latest.db (same contents)
and to restore:
Download latest file from server, something like http://www.site.com/school/latest.db
Replace data/data/package_name/databases/school with the downloaded latest.db
I been reading about SOA and REST approaches but I couldn't implement that on the trivial server I own... any other advices? /cheers
SOA or REST would be the most pretty way to do it. The easy way is just to get the database file and send it to you webserver. But I don't know if your app has enough privileges to restore the database while running.
You could use the sqlite3 commandline tool to dump an sql file, see here and send it to your webserver. Restoring would be something the same, but then you have to delete your tables first, then restore the database with the retrieved data.
Maybe it would be nice to have some version dependency management like sending your app version with the backup. This way you can administer whether a database file is compatible or not.

Android SQLite and Data storage Pros/Cons

What is the best way for an app to push and pull data from an external database?
I want users of my app to be able to write to the database as well as view record data.
Would I use a SqLite database on a webserver somewhere? Does the database type make a difference?
Would an XML file work?
I am thinking that I can have data in my app. So, as users write new records, other users would be able to see those updates.
Suggestions? Comments? What's the best way to do this?
I personally use a local SQLite db on the android, that uses HTTPposts to interact with php on my webserver, which then accesses a mySQL instance. Communication is done through serialized JSON objects as text, gzipped. Transfers about 50kb of raw text as 10kb compressed, very manageable.
Theres lots of excellent tutorials here and otherwise, if you do a little googling for httppost android.
It is generally recommended NOT to have your mobile device have direct access to the online database, for better security and abstraction. Besides php can do some great stuff like doubly validate inputs.

Categories

Resources