Installation guide

6. mxODBC Connection Objects
The DriverConnect() API is only available if the ODBC driver or ODBC
driver manager supports this. It is available on all supported ODBC driver
manager subpackages such as the one for Windows and
iODBC/unixODBC/DataDirect on Unix platforms. See the subpackages section
for details.
ODBC(dsn, user='', password='', clear_auto_commit=1,
errorhandler=None)
Is just an alias for Connect() needed for Python DB API 1.0 compliance.
6.4 Default Transaction Settings
ODBC usually defaults to auto-commit, meaning that all actions on the
connection are directly applied to the database. Since this can be dangerous,
mxODBC defaults to turning auto-commit off at connection initiation time
provided the database supports transactions.
All connection constructors implicitly start a new transaction when connecting to
a database in transactional mode.
When connecting to a database with transaction support, you should explicitly do
a
.rollback() or .commit() prior to closing the connection. mxODBC does an
automatic rollback of the transaction when the connection is closed if the driver
supports transactions.
6.4.1 Overriding the Default
The value of the clear_auto_commit connection parameter overrides this default
behavior. Passing a
0 as value disables the clearing of the auto-commit flag and
lets the connection use the database's default commit behavior. Please see the
database documentation for details on its default transaction setting.
Use the connection method
connection.setconnectoption(
SQL.AUTOCOMMIT, SQL.AUTOCOMMIT_ON|OFF|DEFAULT)
to adjust the
connection's behavior to your needs after the connection has been established,
but before you have opened a database cursor.
With auto-commit turned on, transactions are effectively disabled. The
rollback() method will raise a NotSupportedError when used on such a
connection.
89