Abstracted from database implementation

Database access is now wrapped, so we can easily exchange the engine. Use
only SQL common to SQLite and PostgreSQL.
Relative path now in environment variable instead of conf files