Working demo SQLite with C++ on Mac OSX Xcode
This was developed for Mac OSX which seems the preferred database.
Problems with the alternatives databases:
Open source Maria DB does not work at all which appears to be a mess
MYSQL is unstable and incomplete thanks to Oracle butchering it
Postgres development libraries seem complex for Xcode or just does not link up for some reason
SQLite seems to be the only one that work. For my new version 2 system, this should be fine for very simplistics needs as long as I don’t need it for Clustering on multiple systems
Instructions here:
Install SQLite3 with: brew install sqlite3
This could already be installed by default in your Mac OSX
You could use this to Download SQLiteBrowser from http://sqlitebrowser.org/
I installed using http://macappstore.org/sqlitebrowser/
brew cask install sqlitebrowser
I installed Valentina Studio through Apple OS X App store which is free
Could make a sample C++ client for SQLite
//tutorialspoint.com/sqlite/sqlite_c_cpp.htm
//http://forums.macrumors.com/threads/using-sqlite3-from-c-application.684791/
#include <stdio.h>
#include <sqlite3.h>
int main(int argc, char* argv[])
{
sqlite3 *db;
char *zErrMsg = 0;
int rc;
rc = sqlite3_open(“test.db”, &db);
if( rc ){
fprintf(stderr, “Can’t open database: %s\n”, sqlite3_errmsg(db));
return -1;
}else{
fprintf(stderr, “Opened database successfully\n”);
}
sqlite3_close(db);
}
My working demo with SQLite
Helpful tutorial video
Comments