def on_connect(self):
    'Initialize the connection, authenticate and select a database'
    self._parser.on_connect(self)
    if self.password:
        self.send_command('AUTH', self.password)
        if (nativestr(self.read_response()) != 'OK'):
            raise AuthenticationError('Invalid Password')
    if self.db:
        self.send_command('SELECT', self.db)
        if (nativestr(self.read_response()) != 'OK'):
            raise ConnectionError('Invalid Database')
Initialize the connection, authenticate and select a database
def on_connect(self):
    
    self._parser.on_connect(self)
    if self.password:
        self.send_command('AUTH', self.password)
        if (nativestr(self.read_response()) != 'OK'):
            raise AuthenticationError('Invalid Password')
    if self.db:
        self.send_command('SELECT', self.db)
        if (nativestr(self.read_response()) != 'OK'):
            raise ConnectionError('Invalid Database')