'Opens a connection to the specified database. Only the thread calling this method may
use this connection. The connection must be closed with close_dbhandler() when this
thread exits. This function is called by any thread.
;param subject: the database to open. Must be one of the subjects specified here.
:return: a reference to a DBHandler class for the specified subject or
None when the Session was not started with megacache enabled.'

def open_dbhandler(self, subject):

    if (not self.config.get_megacache_enabled()):
        raise OperationNotEnabledByConfigurationException()
    if (subject == NTFY_PEERS):
        return self.lm.peer_db
    elif (subject == NTFY_TORRENTS):
        return self.lm.torrent_db
    elif (subject == NTFY_MYPREFERENCES):
        return self.lm.mypref_db
    elif (subject == NTFY_VOTECAST):
        return self.lm.votecast_db
    elif (subject == NTFY_CHANNELCAST):
        return self.lm.channelcast_db
    else:
        raise ValueError((u'Cannot    open    DB    subject:    %s' % subject))
