added prepare_database() function to connect and prepare logging database for use