Installation guide
5. mxODBC Overview 
those cases where you would really back out of a certain modification, e.g. due to 
an unexpected error in your program. 
mxODBC turns off auto-commit whenever it creates a new connection, ie. it 
runs the connection in manual commit mode -- unless the connection 
constructor flag clear_auto_commit is set to 0 or the database does not 
provide transactions. 
You can adjust the connection's commit mode after creating it using the 
connection.autocommit attribute. See 5.5.3 Adjusting the Connection Commit 
Mode for details. 
5.5.2 Manual Commit 
Using a connection in manual commit mode means that all your commands are 
grouped in transactions: only the connection will see the changes it has made to 
the data in the database until an explicit 
connection.commit() is issued. 
The commit informs the database to write all changes done during the last 
transaction into the global data storage making it visible to all other users. A 
connection.rollback() on the other hand, tells the database to discard all 
modifications processed in the last transaction. 
  Transaction Start and End 
New transactions are started implicitly in the following cases: 
•  creation of a new connection, 
•  on return from a 
.commit() and 
•  after having issued a 
.rollback(). 
Unless you perform an explicit 
connection.commit() prior to deleting or closing 
the connection, mxODBC will try to issue an implicit rollback on that connection 
before actually closing it. 
Errors are only reported in case you use the 
connection.close() method. 
Implicit closing of the connection through Python's garbage collection will ignore 
any errors occurring during rollback. 
  Data Sources without Transaction Support 
Data sources that do not support transactions, such as flat file databases (e.g. 
Excel or CSV files on Windows), cause calls to 
.rollback() to fail with an 
NotSupportedError. mxODBC will not turn off auto-commit behavior for these 
sources. The setting of the connection constructor flag 
clear_auto_commit has 
no effect in this case. 
67 










