Added database functions to set up connections etc.

also added persistenceException class