SQLite Connection String for iPhone Application in C# - iphone

I am trying to learn iPhone App Development using MonoDevelop and C#. I have created a sqlite database file userinfodb_v1.sqlite and placed it in a subfolder called Data in my project. Now I am trying to write the connection for the application to fetch data from the tables. I haven't got much clue as to how I should form the connection string as I have only about started. This is what I am doing:
string strconn=Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Data");
scon=new SqliteConnection(strconn);
scon.Open();
However this is not working as the connection is failing. What should I do to establish a connection? Where is the error in my code? Can you help me correct it? Any help will be massively appreciated. What does Environment.SpecialFolder mean? Where should I keep the database file in order to access it properly?
Many Thanks in anticipation.

When your application starts you need to copy the database file from the bundle to the Personal folder.

Related

Secure way to store database connection string in heroku

I have an open source project on github, and I want to know a way to store my database's connection string without sharing it within the code.
Maybe uploading a file that is not on git, with the credentials. Is it possible on Heroku? If not, how do I achieve this?
Thanks in advance
That's what config vars are for. Set one, and it will be available to your app as an environment variable. It lives outside your code base, as you (rightfully) want.

Unable to view Database with Sqlite plugin Phonegap - no file extension

I am using phonegap to create an app and am unable to view the database with the sql lite plugin (http://www.tylerfrankenstein.com/user/4/browse-android-emulator-sqlite-database-eclipse). Unfortunately, even though I can find the database that my app has created, for some reason labelled as 1 I cannot use the viewer. I can use the viewer on the Databases.db file. Looks like the problem is that it doesn't have the db extension?? Why can't I view the DB from within Eclipse? Driving me crazy, any help would be greatly appreciated.
The app is successfully creating a database, storing and pulling information out of it so I know it is working correctly, I just need to be able to view it to develop further more easily.
Here's what it looks like in Eclipse, note that the sql lite button is greyed out and the file is just 1 instead of 1.db as I would expect. I can't find anyone else experiencing the same problem...

How to retrieve the data from the database using CoreData

I am learning core data concept and i want to use this in my simple app.
I have did the sample from the below link.
http://www.techotopia.com/index.php/An_iOS_4_iPhone_Core_Data_Tutorial_%28Xcode_4%29
i have did everything and followed the steps described in that link.
Generally i have added the data to tables(entity) and fetched the records using core data.
But my question is==> Once i closed(killed) the app from simulator (or) device means, the data stored in db also cleared. Next time when open that app again means, db will be empty.
In the above link also, this would be happened.
How to store data permanently in db(sqlite) using core data?
i want data(records) which i stored previous in that db. How to achieve it?
Please Help in this regards!!!
Thanks in advance.
Tutorial from raywenderlich would be a good start to learn for coredata... below is the link for the same...
http://www.raywenderlich.com/934/core-data-tutorial-getting-started
For your question : i want data(records) which i stored previous in that db. How to achieve it?
if you will delete the app either from device or simulator your database will be deleted. If you are testing on simulator and you have made db file in Resource bundle then everytime you run the project, Your database will be replaced by your database file in Project bundle..
please see clear yourself how project refers to db while running in simulator.

Extract a table from call_history.db using C++ and sqlite

I'm developing an iphone app that retrieves the call log information and store it with the number of missed,incoming and received calls over that time. Here, since the call log is a .db file, i have to first access the call log details and extract it using C++ and sqlite.
Can anyone suggest me how to extract the table named "call" from call_history.db database file and store it in a text file?
I don't think that is allowed by Apple to access the call history database... If it is, which I seriously doubt, then you should be able to open it using sqlite3. There are plenty of tutorials available online how to do this but again, I think, if it is even possible, that your app will be rejected for this...
If you still want to try, the call_history.db file is probably a sqlite3 database.
Have a look at the documentation to see how to access it from your code. If you want to analyze the contents first to find out the schema, just use the command line application sqlite3.

Is there a way to access AddressBook db file programmatically?

i need to copy this database file and save it in someother location or i can take backup of the db file. is there a way to do this programmatically.
Thanks
Satish
Unless you've jailbroken your iPhone, there's no way of accessing the sqlite3 database directly on the phone.
If you're talking about getting access to the database from your computer, you can do it by grabbing the database files out of the iPhone backup files. To do that, you'll need to grab a copy of Erica Sadun's mdhelper (binary file) command line utility, and run it from the PC you sync your laptop with like so:
mdhelper -files "AddressBook.sqlitedb" -extract -glob
This will create a "~/Desktop/Recovered iPhone Files" directory containing a file called AddressBook.sqlitedb, which you can access directly or query using your programming language of choice.
If you don't trust downloading and running binary files without knowing what they do, you can look at the source on Github and compile it yourself.
the SQL database can be extracted from an iphone backup. I used this software to grab mine and the SMS database.
If you have lots of images/videos in camera roll it can take a while to run.
http://www.supercrazyawesome.com/
Yeah sorry abt that. ok thanks probably i will create a new database using AddressBook Apis
-Satish
You can also take a backup of your iphone and than use one of tools discribed here to identify the file you need.