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 9191083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:36:03+00:00 2026-06-17T20:36:03+00:00

Am making an iOS apps with an embedded SQLite database. So I make my

  • 0

Am making an iOS apps with an embedded SQLite database. So I make my DB in a SQLite administrator and drag it to my Xcode project, like in the tutorial says.
When I try open my DataBase, I get this error: “out of memory”. Dont know if it is a SQLite bug or something, but my file is really small to get a memory problem.

This is my code to init my DataBase:

- (id)initWithPath:(NSString *)path {
if (self = [super init]) {
    BOOL success;
    NSError *error;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *dbPath = [documentsDirectory stringByAppendingPathComponent:@"SoundLib_DB.sqlite"];

    if ([fileManager fileExistsAtPath:dbPath] == NO) {
        NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"SoundLib_DB" ofType:@"sqlite"];
        [fileManager copyItemAtPath:resourcePath toPath:dbPath error:&error];
    }

    success = [fileManager fileExistsAtPath:dbPath];
    if(!success)
    {
        NSLog(@"Cannot locate database file '%@'.", dbPath);
    }
    sqlite3 *dbConnection;
//Here is when I get the error, at trying to open the DB
    if (sqlite3_open_v2("SoundLib", &dbConnection, SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK) {
        NSLog(@"[SQLITE] Unable to open database!");
        NSLog(@"%s Prepare failure '%s' (%1d)", __FUNCTION__, sqlite3_errmsg(database), sqlite3_errcode(database));
        return nil;
    }
    database = dbConnection;
}
return self;

}

  • 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-17T20:36:04+00:00Added an answer on June 17, 2026 at 8:36 pm

    Error may be because you need to pass databasepath as UTF8String. I see you are passing “SoundLib”. You can not directly pass like that.

     if (sqlite3_open([dbPath UTF8String], &databaseHandle) == SQLITE_OK)
    {
       //dbPath is your full database path you getting above
    }
    

    P.S. Also have dbpath as const char

    const char *dbpath
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making an ios app in xcode 4 and need to make a UIScrollView
I am new to making iOS apps. I want to make a Split View
I'm making Catalog like iOS application. using Xcode 4.2 with story board. This application
I'm making a webapp for iOS. When I make a dropdown list with the
So, I've been making iOS apps since the first iPod touch came out, but
I'm making an iOS app in Xcode 4 that needs to save one NSString
I have an app where I am making my iOS device make a sound
im making an ios app in xcode 4 and I need a square UIImageView
Im making an ios app in xcode 4 and I need a way of
I'm making an iOS app like Kik messenger. I'm worried that the chat will

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.