Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9148869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:23:26+00:00 2026-06-17T11:23:26+00:00

I have SQLite Studio fot my Mac OSX, I create there my Schemas, in

  • 0

I have SQLite Studio fot my Mac OSX, I create there my Schemas, in MySQL I use DBFork Manager a case tool to make my Schemas, I export sql file and then import into MySQL Server, so I want to do the same for my iOS App using SQLite.

I mean, I make my SQLite Schema, then I need to import into my App from a *.sql file, I give my code example using a SQL string… Hope you can help me!

- (void)viewDidLoad {
NSString *docsDir;
NSArray *dirPaths;

// Get the documents directory
dirPaths = NSSearchPathForDirectoriesInDomains(
                                               NSDocumentDirectory, NSUserDomainMask, YES);

docsDir = dirPaths[0];

// Build the path to the database file
_databasePath = [[NSString alloc]
                 initWithString: [docsDir stringByAppendingPathComponent:
                                  @"contacts.db"]];

NSFileManager *filemgr = [NSFileManager defaultManager];

if ([filemgr fileExistsAtPath: _databasePath ] == NO)
{
    const char *dbpath = [_databasePath UTF8String];

    if (sqlite3_open(dbpath, &_contactDB) == SQLITE_OK)
    {
        char *errMsg;
        const char *sql_stmt =
        "CREATE TABLE IF NOT EXISTS CONTACTS (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, ADDRESS TEXT, PHONE TEXT)";

        if (sqlite3_exec(_contactDB, sql_stmt, NULL, NULL, &errMsg) != SQLITE_OK)
        {
            _status.text = @"Failed to create table";
        }
        sqlite3_close(_contactDB);
    } else {
        _status.text = @"Failed to open/create database";
    }
}
[super viewDidLoad];

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:23:27+00:00Added an answer on June 17, 2026 at 11:23 am

    I assume you have a database file in SQLite and want to install it for use on your iPhone. If you compile it in your program, then it will be in the file bundle. However, that’s read only, so if you want to alter your database at all, you need to copy it to the iphone’s documents directory (or another more appropriate directory). Check out the answer to this stackoverflow question:

    SQLite on iPhone

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have normal sqlite database and want to use fts3. As mentioned in http://www.sqlite.org/fts3.html
I have an SQLite database, eventually will be a MySQL database and I'm using
I have a DLL >> System.Data.SQLite.dll To use it in a normal way >
I have a rooted Nexus S and it doesn't have Sqlite installed so I
I have my SQLite db storing my info and it works ok. However I
I have an sqlite database I want to distribute with my application. It's about
I have a sqlite table representing a weighted directed graph. The columns are as
I have an SQLite database in my application. When I go to check if
I have a SQLite database that contains a huge set of log messages. I
I have a SQLite table called posts . An example is shown below. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.