'Connect to the database. Assume that the connection is closed.'

def connect(self):

    self.check_settings()
    self.in_atomic_block = False
    self.savepoint_ids = []
    self.needs_rollback = False
    max_age = self.settings_dict['CONN_MAX_AGE']
    self.close_at = (None if (max_age is None) else (time.time() + max_age))
    self.closed_in_transaction = False
    self.errors_occurred = False
    conn_params = self.get_connection_params()
    self.connection = self.get_new_connection(conn_params)
    self.set_autocommit(self.settings_dict['AUTOCOMMIT'])
    self.init_connection_state()
    connection_created.send(sender=self.__class__, connection=self)
    self.run_on_commit = []
