I need a small database for my cocoa project...
27/01/04 09:53
I need something light, if possible free (freeware, LGPL, BSD, ... licensing), fast and with trouble-free installation from my users point of view… any idea ?
Well, several options exist "out of the box" under Mac OS X:
1. if the data to handle is not too large, you can use property lists as a database… of course it's memory based so if you plan to handle huge amount of data, it's probably not the way to go;
2. if the property list format is not good enough, you can use another XML format, even create your own and use the XML libraries shipping with OS X (/Library/libxml.framework, /Library/libxml2.framework, /Library/libxslt.framework, /Library/libexslt.framework);
3. You can archive and unarchive NSObject using NSArchiver and NSUnarchiver classes;
4. There are also more traditional Unix libraries on your Mac OS X box: see /usr/include/db.h and /usr/include/ndbm.h. There are plenty of example code available on the Net using these libraries.
Source code of these libraries or equivalent ones is also available on the Net. For example: GNU dbm and SleepyCat (be careful, some are under GPL not LGPL!);
We provide here a small Objective-C wrapper around ndbm library and here another one based on Gdbm (FAT format)- just examples to be used as starting point;
5. Some OpenSource solutions exist with various licensing scheme: SQLLite being often the most referenced one, but xBase libraries are also available (to handle files in the "old" dbBase format);
6. feel free to add your own suggestions...
1. if the data to handle is not too large, you can use property lists as a database… of course it's memory based so if you plan to handle huge amount of data, it's probably not the way to go;
2. if the property list format is not good enough, you can use another XML format, even create your own and use the XML libraries shipping with OS X (/Library/libxml.framework, /Library/libxml2.framework, /Library/libxslt.framework, /Library/libexslt.framework);
3. You can archive and unarchive NSObject using NSArchiver and NSUnarchiver classes;
4. There are also more traditional Unix libraries on your Mac OS X box: see /usr/include/db.h and /usr/include/ndbm.h. There are plenty of example code available on the Net using these libraries.
Source code of these libraries or equivalent ones is also available on the Net. For example: GNU dbm and SleepyCat (be careful, some are under GPL not LGPL!);
We provide here a small Objective-C wrapper around ndbm library and here another one based on Gdbm (FAT format)- just examples to be used as starting point;
5. Some OpenSource solutions exist with various licensing scheme: SQLLite being often the most referenced one, but xBase libraries are also available (to handle files in the "old" dbBase format);
6. feel free to add your own suggestions...