Database connexion

Also exceptions and some minor features