Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wyattbiker

macrumors member
Original poster
Mar 7, 2009
42
4
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);
 

yayaba

macrumors 6502
Apr 24, 2007
297
0
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:

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);
 

wyattbiker

macrumors member
Original poster
Mar 7, 2009
42
4
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);

Thank you. And yes, I found them under funny names.
 

tskoti

macrumors newbie
Nov 5, 2008
6
0
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.