Rewrite database management, Fixed setCalendar

Now the program does not try to use a persistent database connection
(makes it very complex either using statics or many pointers etc.). Now
Compiles!