How to store user data on Heroku - facebook

I'm making a Facebook app that runs on Heroku. The app will send data to the Heroku server where it will be stored. Preferably it will store this data in a text file, because that seems to be the easiest way.
Can this be done? I know that Heroku lets you store data in some kind of database but that seems more than necessary.

Yes, it can be done, but as a db not as a flat file.
Read up on the PostgreSQL here: https://devcenter.heroku.com/articles/heroku-postgresql
Why not a flat file? http://devcenter.heroku.com/articles/read-only-filesystem
Because the file system is read-only. And Heroku recommends you use the PostgreSQL for data storage.

Related

Getting SQLite from remote and store locally in Flutter

Im setting up an app, a sort of local guide; my idea is to have the app to work even offline, by storing most of its content locally in a SQLite database.
Since i already have the content in a database, i'd like to retrive that database from my server and store it; i already know how to get data from an API and save it in the local database, but i think getting the db file from remote and cloning in the app its lesse labour intensive.
At the moment running the app the first time i can create the empty database, and save the date of the action, i can also GET from http the database, but i dont know where to save it to have my local database use this data (to be honest i don't even know if it is possible), also i would like to periodically check on remote to see if the data was updated and get a fresh db to override the one present.
Anyone know if and where to save the db content from remote?
Thank you

iOS Programming suggestion request REF sqlite/iOS app design

I currently have an iOS app that provides a sqlite DB for the data backend to the app. This data is basically a list of information. Within this app I allow the users to mark records as bookmarked (sets a value in the DB). The problem here is when I post updates to the app via the internet (update through software) for data changes, the new downloaded DB wipes out the old one thereby removing the user customizations.
Any ideas on an easy method to search the current sqlite DB for those changes, store them temporarily, then import the new DB and transfer the changes to the new DB? Could I for instance use a Core Data element at the same time as using the sqlite DB backend? Maybe a key/value pair system?
Any suggestions would be greatly appreciated.
Thanks
-LK
The way I've done it is this:
For your new version, rename your .sqlite file e.g. foo-v2.sqlite. Then, during initialization, check to see if the sqlite file for the old version is there - if so, copy over the necessary info and then delete the old sqlite file.

How do you get data from a remote MySQL database into your app?

Have just finished a couple of tutorials regarding populating a SQLite database with data and then using this data within your app.
However none of these tutorials show how to connect to a remote server in order to obtain data.
QUESTION:
How do you get data from a remote MySQL database into your app??
What options do you have?
Remote access is not a good idea, you would have to allow everyone to access it since it's an app. The best way to go about this is to build a layer between your app and database. From the app you would access a server side script which does the database work and responds to your app.
Well there are methods to allow remote access to your mysql database on your server and being able to query the database remotely. I think this is the cleanest solution. Check out this link: http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

how to use sqlite db created from core data after repopulating it on the server side?

I created sqlite db from core data and i want to repopulate it on the server side and download it again to device with overwriting existing sqlite db. Is it possible to repopulate on server side and is it work if overwrite with existing db?
As far as i know, if you are saving data through core data, it will create usual sqlite db, but all tables, field names will has a Z_ prefix.
You can simply use this db on the server side, that download it as file and overwrite exiting db on device.
Sorry for my broken english if something wrong.
Do not ever mess with a Core Data db outside of the application. In fact, forget it is a db because it is simply a storage mechanism.
What you need to do is to send the objects to the server (xml is probably the easiest), manipulate the data on the server, send the data back to the app, import the data into Core Data.

on-the-device database for my iphone app

I want to have on-the-device database for my iphone app. It concerns with the data, which comes from dictionary consisting of 200.000 things and their definitions. It is only related with text-type data as appeared. My questions:
1- Does SQLite hold all of these data?
2- When the client downloaded my app, he/she will also have the db in his/her device. Does app store allow me to update my app's db and upload my new release? (i don't know these issues well by the way)
3- And can any client, who downloaded my app, hack and obtain my database? Is there any prevention methods? Is SQLite resilient enough against these?
1- Does SQLite hold all of these data?
Yes, SQLite can cope with this amount of data.
2- When the client downloaded my app,
he/she will also have the db in
his/her device. Does app store allow
me to update my app's db and upload my
new release? (i don't know these
issues well by the way)
The general approach is to store the SQLite database in your application bundle and then copy the database into the application's document directory on the device when the application is first run. On subsequent updates to your applciation, you should check if the database within the document directory is the same version and update it if necessary. See the existing Run NSBundle from the documents folder question/answer for more information on this.
3- And can any client, who downloaded
my app, hack and obtain my database?
Is there any prevention methods? Is
SQLite resilient enough against these?
It's fairly trivial to open up an app (the deployment package is just a zip file after all), so yes, it will be possible to obtain access to your database data. Unfortunately there's no easy way around this that I'm aware of. (You could I suppose download the data from a server when you first run you app, but it'll still be accessible on a jailbroken device.)
Sometimes, you just have to bite the bullet and accept the fact that your data is going to be ripped off.
1) sqllite can definitely hold that amount of data.
2) You can put up an option of refreshing the database in your app. That can be used to sync the local db with the server copy. Updated db can also be added with the new version of the app.
3) You can encrypt your local db using SQLCipher for protecting your application db against hacks.