saves state of database connection