Installation guide
mxODBC - Python ODBC Database Interface 
Example: 
def debug_errorhandler(connection, cursor, errorclass, errorvalue): 
 sys.stderr.write('debug_errorhandler: %s: %r\n' % 
 (errorclass, errorvalue)) 
db = DriverConnect('DSN=drivernotfound;UID=sa;PWD=test', 
 errorhandler=debug_errorhandler) 
The error handler will be called for all messages coming from the ODBC driver 
and manager, including warnings which are then ignored by mxODBC, and print 
these to 
stderr for review. 
Depending on how the ODBC driver is written, the above may result in lengthy 
output or even cause more severe problems, because the error handler does not 
raise an exception which would cause the connect processing to stop. mxODBC 
will continue setting up the connection as if it were existing and this can result in 
segfaults with some drivers. 
A safer variant looks like this: 
errors = 0 
def debug_errorhandler(connection, cursor, errorclass, errorvalue): 
 global errors 
 errors += 1 
 sys.stderr.write('debug_errorhandler: %s: %r\n' % 
 (errorclass, errorvalue)) 
 if errors > 5: 
 raise errorclass(*errorvalue) 
 64-bit Platforms 
• 
On 64-bit platforms you may run into problems with unixODBC since it 
uses 32-bit SQL length types for versions prior to 2.2.13. Some ODBC 
drivers on Unix instead use 64-bit SQL length values and will therefore 
not return correct results when used with unixODBC.
The binary version eGenix.com ships was compiled against unixODBC 
2.3.1 (or later) and expects 64-bit SQL length types. If you need a version 
for unixODBC 2.2.12 or earlier, please either use our older mxODBC 3.0 
release or write to support@egenix.com for help. 
•  Commercial ODBC drivers for Unix are often compiled using 64-bit SQL 
length types and 32-bit Unicode types. unixODBC uses the same types 
starting with version 2.3. 
•  You may run into problems with ODBC drivers compiled against iODBC. 
While unixODBC follows the ODBC standard of using 32-bit Unicode 
types, iODBC defaults to using the Unix 64-bit standard. As a result, 
ODBC drivers compiled against iODBC will not work reliably with 
Unicode data when used with unixODBC. 
178 










