As in DBAPI2.0:
        Commit any pending transaction to the database. Note that
        if the database supports an auto-commit feature, this must
        be initially off. An interface method may be provided to
        turn it back on.

        Database modules that do not support transactions should
        implement this method with void functionality.

def commit(self):
        """
        As in DBAPI2.0:
        Commit any pending transaction to the database. Note that
        if the database supports an auto-commit feature, this must
        be initially off. An interface method may be provided to
        turn it back on.

        Database modules that do not support transactions should
        implement this method with void functionality.
        """
        try:
            self.__dbapi2_conn.commit()
        except Exception, e:
            # try to reconnect
            self.reconnect(None)
            self.__dbapi2_conn.commit()