mxODBC Configuration Guide

Home People mxODBC Emulation
Python

Note

This document will shortly be revised to exclude details of the mxODBC 1.x series.

Abstract

mxODBC is a package for the Python programming language, providing connectivity to relational database management systems (RDBMSs) using the ODBC standard. This document aims to explain how to configure mxODBC on UNIX systems.

Note that in this document I will use the term "database system" to mean RDBMS unless otherwise stated. This seems to be a common application of the term.

Author: Paul Boddie (paul@boddie.org.uk)

Starting

With mxODBC version 2.0.0, the method of installation has changed from version 1.1.1. Here, instructions are provided for both releases.

mxODBC Version 2.0.0

First, read the instructions for the database systems you intend to use mxODBC with. Only after making the appropriate adjustments to the configuration files should you attempt to install mxODBC as this is a genuine installation process which will typically put files in special places within your Python installation.

Once you have made the appropriate adjustments, follow the instructions in the mxODBC documentation. In brief, you will need to install the egenix-mx-base-2.0.0 package in order to make the mxDateTime package available to mxODBC. Then, you will need to install the egenix-mx-commercial-2.0.0 package in order to make the mxODBC package available in your Python installation. For both of these packages, installation is done by entering the root directory of each package and issuing the following command:

python setup.py install

You may need to be the root user for this command to work successfully.

mxODBC Version 1.1.1

Follow the instructions in the mxODBC documentation concerning the installation of the software (along with the mxDateTime package). In this document, when referring to this version of mxODBC, we shall refer to the location of these packages as /home/mx, so that /home/mx/ODBC and /home/mx/DateTime are the locations of the installed mxODBC and mxDateTime packages respectively.

Suitability

First, it is important to be aware of the range of database modules available for Python. ODBC configuration can be very time-consuming, and if you can get a "native" module (meaning a module which uses the database system's own API) working using a reasonably convenient compilation, linking and installation procedure then you will probably have saved a considerable amount of time; this is likely to be the case if you have some Python experience but little ODBC experience.

Database Suitability

There are, in my experience, two types of database system concerning connectivity issues:

If a database system is supplied with ODBC drivers then it may be worth trying mxODBC even if a "native" module is available. This is because mxODBC provides one of the nicest/closest implementations of the DB-API specification (version 2) that I have seen.

If a database system only provides its own libraries then be prepared to spend a lot of time finding the right drivers, configuring them, and learning how they operate, should you decide to choose ODBC as the connection mechanism. In comparision, the "native" modules are usually straightforward enough to install, although they may require header files not supplied with the database system and this could prevent you from building those modules unless you find such header files in other locations. In such situations you may end up being forced to choose ODBC. However, even if all the necessary resources are available, mxODBC may implement the DB-API specification better than the available "native" module and, in such cases, ODBC is going to be practically unavoidable - not all of the modules for Sybase have, in the past, tended to support parameters in queries/actions, but this feature is very useful for serious work.

An example of missing header files involves Sybase Adaptive Server Enterprise (ASE) version 11.5 for Solaris 2.6. This product lacks the sqlda.h file which is needed by ctsybasemodule. However, it can be found in certain downloadable packages on Sybase's Web site.

Database Systems with ODBC Drivers

The following database systems are supplied with ODBC drivers:

Sybase Adaptive Server Anywhere 6.0.3

Sybase Adaptive Server Anywhere (ASA) version 6.0.3 for Linux can be used with mxODBC either with or without the iODBC driver manager. The following instructions describe the process of using the supplied drivers directly.

mxODBC Version 2.0.0

mxODBC Version 1.1.1

Troubleshooting

Database Systems without ODBC

The following database systems are provided without ODBC drivers:

Sybase Adaptive Server Enterprise 11.5

Sybase Adaptive Server Enterprise (ASE) version 11.5 for Solaris 2.6 is provided with some libraries which enable client applications to connect to and use the database system. However, these libraries do not directly support ODBC connectivity.

One source of ODBC drivers for ASE is OpenLink Software. They have many products, but the "Data Access Driver Suite (Multi Tier Edition) Version 3.2" product can be persuaded to work. The following instructions describe the process.

mxODBC Version 1.1.1

Solid Embedded Engine 3.5

Solid Embedded Engine version 3.5 for Solaris 2.6, when downloaded for evaluation, is provided with some ODBC libraries and some demonstration programs which connect to a database using the ODBC API. However, I could not get mxODBC to work with these libraries, receiving errors when the SQLNumParams function was invoked.

However, OpenLink Software is, as with Sybase ASE, to the rescue with their "Data Access Driver Suite (Multi Tier Edition) Version 3.2" product. Follow the instructions as you would for Sybase ASE, substituting "Solid" for any "Sybase" references, and Sybase-related filenames with the equivalent Solid-related filenames. It does not seem to be necessary to tell the OpenLink request broker to use any particular port in order to access a database, at least if that database is being "exported" on the default TCP/IP port 1313. Presumably, the /home/openlink/bin/oplrqb.ini file would need to be modified and the SOLID environment changed to recognise different addresses and ports.

iODBC

Unless you can link mxODBC directly with an ODBC driver, which is the case for some database systems you will need to install the iODBC driver manager. I found that the iODBC Developers Open Source Release V2.50.3 was suitable for Solaris 2.6, but for Linux the "iODBC Driver Manager Runtime Package" and "iODBC Developers Kit" seem to work as well.

Even if you installed the OpenLink components, to build the ODBC.iODBC module you may still need to find the header files for iODBC, since they may not be provided with those components. Therefore, download the appropriate packages noted above and follow these instructions:

mxODBC Version 1.1.1