Installation guide
mxODBC - Python ODBC Database Interface 
If you connect to the database through an ODBC manager, you should use the 
DriverConnect() API since this allows passing more configuration 
information to the manager and thus provides more flexibility over this 
interface. 
See the following section 6.4 Default Transaction Settings for details on 
clear_auto_commit. 
connection_options may be given as list of (option, value) tuples to set 
pre-connect ODBC connection options. The 
option and value arguments 
must use the same format as the parameters for the 
.setconnectoption() 
method. This list can be used to e.g. enable the MARS feature of SQL Server 
Native Client, which enables working with multiple active result sets on the 
same connection: 
from mx.ODBC.Manager import DriverConnect, SQL 
options = [(SQL.COPT_SS_MARS_ENABLED, SQL.MARS_ENABLED_YES)] 
db = DriverConnect('DSN=mssqlserver2008;UID=sa;PWD=dbs0R-X9.rxD', 
 connection_options=options) 
connect(dsn, user='', password='', clear_auto_commit=1, 
errorhandler=None) 
Is just an alias for Connect() needed for Python DB API 2.0 compliance. 
DriverConnect(DSN_string, clear_auto_commit=1, errorhandler=None) 
This constructor returns a connection object for the given data source which is 
managed by an ODBC Driver Manager (e.g. the Windows ODBC Manager or 
iODBC). It allows passing more information to the database than the standard 
Connect() constructor. 
errorhandler may be given to set the error handler for the Connection object 
prior to actually connecting to the database. This is useful to mask e.g. certain 
warnings which can occur at connection time. The 
errorhandler can be 
changed after the connection has been established by assigning to the 
.errorhandler attribute of the Connection object. The default error handler 
raises exceptions for all database warnings and errors. See section 10.4 Error 
Handlers for more details on how to use error handlers. 
Please refer to the documentation of your ODBC manager and the database for 
the exact syntax of the 
DSN_string. It typically has this formatting: 
'DSN=datasource_name;UID=userid;PWD=password' (case can be 
important and more entries may be needed to successfully connect to the data 
source). 
See the following section 6.4 Default Transaction Settings for details on 
clear_auto_commit. 
connection_options may be given as list of (option, value) tuples to set 
pre-connect ODBC connection options. The 
option and value arguments 
must use the same format as the parameters for the 
.setconnectoption() 
method. This list can be used to e.g. enable the MARS feature of SQL Server 
Native Client, which enables working with multiple active result sets on the 
same connection: 
from mx.ODBC.Manager import DriverConnect, SQL 
options = [(SQL.COPT_SS_MARS_ENABLED, SQL.MARS_ENABLED_YES)] 
db = DriverConnect('DSN=mssqlserver2008;UID=sa;PWD=dbs0R-X9.rxD', 
 connection_options=options) 
88 










