Where in the world is the SQLite database file?

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

  1. wyattbiker macrumors member

    Mar 7, 2009
    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:

         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

    Apr 24, 2007
    San Francisco Bay Area
    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:

    		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

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

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


    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,

Share This Page