Installation guide
mxODBC - Python ODBC Database Interface
3.3 Accessing Databases from Unix
mxODBC is often used to access databases across a network. A very typical use
case is that of connecting to MS SQL Server, Oracle or DB2 from a Unix machine.
eGenix.com has collected some information in the next section 4. Accessing
Popular Databases which may help you in finding the right solution for this kind of
setup. We recommend that you always use an ODBC manager on Unix to access
these driver setups, e.g. unixODBC, iODBC, or the DataDirect ODBC manager.
Once you’ve installed the ODBC drivers on the machine you are running your
Python application on, you will need to setup an ODBC Data Source. This can be
done using the ODBC manager GUIs which try to mimic the Windows ODBC
Manager, or using a text editor by editing either the system wide ODBC
configuration files (usually /etc/odbc.ini and /etc/odbcinst.ini; Mac OS X uses
/Library/ODBC/odbc.ini and /Library/ODBC/odbcinst.ini) or the user home
directory versions (usually ~/.odbc.ini and ~/.odbcinst.ini).
To avoid problems with system permissions, eGenix.com recommends setting up
data sources as System Data Sources using the GUI tools or in the system
configuration file /etc/odbc.ini using a text editor, as these are usually accessible
by all accounts on a Unix server.
Using the mxODBC connection constructor
mx.ODBC.Manager.DriverConnect() you can then setup a connection to the
database.
3.3.1 Looking for Unix ODBC Drivers ?
Many database vendors also provide ODBC for various Unix platforms. If you are
looking for Linux drivers, the situation has cleared up a lot in recent years. On
other platforms such as Mac OS X, AIX, Solaris or the BSDs, the situation is a lot
less encouraging.
If you have trouble finding a suitable driver, you can contact the database vendor
or check the SQLSummit list of ODBC drivers
.
eGenix.com also provides a generic solution to such problems in form of the
mxODBC Connect
product, which helps you work around the problem of finding
a suitable ODBC driver for the client platform. See the next section for detail.
3.3.2 mxODBC Connect - a general purpose client-server
solution
Since finding good quality ODBC drivers for Unix platforms is sometimes difficult
and managing them on all client systems can introduce quite a bit of
24