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

  • SEARCH
  • Home
  • 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 6976591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:30:59+00:00 2026-05-27T17:30:59+00:00

I have a project that includes FMDB to manage SQLite databases. I imported and

  • 0

I have a project that includes FMDB to manage SQLite databases. I imported and linked the FMDB wrappers, but problems is that no results are shown when I query the database :

The sqlite database created with Firefox SQLite manager (Ubuntu) and I copy it to Xcode .

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
NSString *path = [docsPath stringByAppendingPathComponent:@"db.sqlite"];

FMDatabase *db = [FMDatabase databaseWithPath:path];

[db open];

FMResultSet *fResult= [db executeQuery:@"SELECT * FROM mytable"];

while([fResult next])
{
    NSLog(@"%@",[fResult stringForColumn:@"title"]);
}
[db close];  
  • 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-05-27T17:31:00+00:00Added an answer on May 27, 2026 at 5:31 pm

    If you have copied your database into xCode then you should search for your database in your application’s main bundle resource path first, then copy it into the Documents directory if it doesn’t exist there yet, only then you can work with it. You might want to debug your FMDatabase object using lastErrorMessage and lastErrorCode messages.

    FMDatabase *db = [FMDatabase databaseWithPath:path];
    NSLog(@"database instantiated: %@", db];
    
    [db open];
    
    NSLog(@"Database has encountered an error with message: %@. And code: %d", db.lastErrorMessage, db.lastErrorCode];
    
    FMResultSet *fResult= [db executeQuery:@"SELECT * FROM mytable"];
    
    while([fResult next])
    {
        NSLog(@"%@",[fResult stringForColumn:@"title"]);
    }
    [db close];  
    

    The other problem might of course sound silly, but if your ‘mytable’ does not contain anything, the while loop expression will always be false. But my best guess – the database is not in the Documents directory.

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

Sidebar

Related Questions

I have a project that includes a copy of phpMyAdmin. I do development locally
I have a very old project that includes the source from another project directly,
I have a project that has the following line in the additional includes section:
I have a visual studio 2008 solution that includes an asp.net-hosted remoting project in
I have a project that I'm currently working on but it currently only supports
We have a project that includes all of our re-usable classes, third-party library JARs
I have a hobby project that includes me driving a LCD by my serial
I currently have a wcf service library project that includes my service contract &
I have this Visual Studio solution that includes a project that has a template
Possible Duplicate: Visual studio keeps building everything I have a project that includes an

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.