Installation guide

mxODBC - Python ODBC Database Interface
Backwards Compatibility Notice:
Please note that mxODBC 3.2 used to set the default cursor type depending on
whether the database supports static cursors or not. For those that do, it used
static cursors, for all others, it used forward-only cursors. In mxODBC 3.3, we
have changed this back to defaulting to forward-only cursors for all databases
due to performance issues with static cursors.
5.8.3 Effects of the Cursor Type on cursor.rownumber
Some databases do not provide accurate information for cursor.rownumber in
case forward-only cursors are used. Examples are MS Access, Teradata and
Oracle.
Since mxODBC 3.3 switched to forward-only cursors for all databases, we have
added a special client-side
.rownumber emulation to mitigate this problem.
If the emulation cannot be provided or the value cannot be determined, the
cursor.rownumber attribute is set to None.
5.8.4 Database Specific Cursor Type Notes
MS SQL Server
MS SQL Server supports backwards scrolling and other more advanced scrolling
modes when using static cursors. With forward only cursors, these scrolling
capabilities are no longer available. The attribute
.rownumber is emulated by
mxODBC, since SQL Server returns wrong results with forward cursors.
We still recommend setting the
.cursortype to SQL.CURSOR_FORWARD_ONLY in
case result set scrolling is not needed by the application, since fetch operations on
static cursors can result in a significant slow-down compared to forward only
cursors.
Adjusting the default cursor type can be done on a per connection basis:
connection = mx.ODBC.Windows.DriverConnect(…)
connection.cursortype = mx.ODBC.Windows.SQL.CURSOR_STATIC
# All cursors created on connection will then default to static
# cursor type, allowing backwards scrolling.
Performance Hint:
In tests we have seen slow-downs from 2-3x for average queries, up to 300x for
simple ones, when using static cursors compared to forward only ones.
Oracle
mxODBC uses forward only cursors as default, since using other types can cause
segfaults in the ODBC driver.
80