Connected the code to the database