Installation guide
mxODBC - Python ODBC Database Interface
# string
db = mx.ODBC.Windows.DriverConnect('DSN=mydb;UID=uid;PWD=pwd')
6.7 Connection Object Methods
.close()
Close the connection now (rather than automatically at garbage collection
time). The connection will be unusable from this point on; an
Error (or
subclass) exception will be raised if any operation is attempted with the
connection. The same applies to all cursor objects trying to use the
connection.
.commit()
Commit any pending changes and implicitly start a new transaction.
For connections which do not provide transaction support or operate in auto-
commit mode, this method does nothing.
.cursor(name=None, cursor_options=())
Constructs a new Cursor Object with the given name using the connection and
initializes any provided cursor options.
If no name is given, the ODBC driver or database backend will determine a
unique name on its own. You can query this name with
cursor.getcursorname() (see the Cursor Object section 7).
The
cursor_options may be given as list of (option, value) tuples. These
are then passed to the cursor's
cursor.setconnectoption() API (see the
Cursor Object
section 7) and allow configuring the cursor upfront to a specific
need.
.getconnectoption(option)
Get information about the connection.
option must be an integer. Suitable option values are available through the
SQL object (see the Constants section 10.5 for details).
The method returns the data as 32-bit integer. It is up to the user to decode
the integer value using the SQL defines available through the
SQL constant.
This API gives you a very wide range of information about the underlying
database and its capabilities. See the ODBC SQLGetConnectAttr API
Documentation for more information.
.getinfo(info_id)
Get general information about the database, the ODBC driver and the ODBC
driver manager.
The
info_id must be an integer. Suitable values are available through the SQL
object (see the Constants
section 10.5 for details).
92