Where in the world is the SQLite database file?

Discussion in 'iOS Programming' started by wyattbiker, Mar 14, 2009.

  1. wyattbiker macrumors member

    Joined:
    Mar 7, 2009
    #1
    I am using the Safari to create a web based database using javascript . The page executes succesfully creating a database and tables. Now I try to find the db file on the mac OS X 10.5. Anyone know where to look? Thanks

    Here is a sample from apples website:


    Code:
         alert ("I am ready to run");
            var shortName = 'mydatabase.db';
            var version = '1.0';
    
            var displayName = 'My Important Database';
    
            var maxSize = 65536; // in bytes
    
            var mydb = openDatabase(shortName, version, displayName, maxSize);
     
  2. yayaba macrumors 6502

    Joined:
    Apr 24, 2007
    Location:
    San Francisco Bay Area
    #2
    If you're on the iPhone simulator mine is in:

    ~/Library/Application Support/iPhone Simulator/User/Applications

    Then there is a long ID string. Multiple runs of your program create a new one so the easiest way to find out is to just print out the filename of your db in your program via NSLog. For example, I print out my location like this:

    Code:
    		NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    		NSString *documentsDirectory = [paths objectAtIndex:0];
    		NSString *path = [documentsDirectory stringByAppendingPathComponent:@"expenses.sqlite"];				
    		NSLog([NSString stringWithFormat:@"SQLite file is at %@", path]);
    		sqlite3_open([path UTF8String], &database);
    
    
     
  3. wyattbiker thread starter macrumors member

    Joined:
    Mar 7, 2009
    #3
    Thank you. And yes, I found them under funny names.
     
  4. tskoti macrumors newbie

    Joined:
    Nov 5, 2008
    #4
    How to create file with name (testSQL.sqlite) in mac.

    hi,

    Plz tell me how to create a file with testFileName.sqlite in MAC, and also, how to create a file which is encoded (UTF8String) format.

    Thanks in Advance,
    Koti
     

Share This Page