Dev-Picayune

picayune: of little value or importance

Python, ODBC and Linux

If you’re using Linux at all and need ODBC access to data sources, you’ve basically got two choices for Python library access, mxODBC and pyodbc. And really, until recently, pyodbc wasn’t really strongly considered a Linux option. In fact, even today, it’s not very Linux friendly to get installed (or at least I didn’t think it was).

I was needing to connect to our IBM iSeries database (AS/400 for most of us who aren’t newbies) from a Linux box. I managed to download and eventually install the IBM Access Client under Ubuntu and I had configured unixODBC stuff to the point that I felt I had a valid DSN setup. It was time to try to connect from Python. Since I work for a non-profit organization, I knew that eGenix had always treated non-profits differently and allowed the mxODBC library to be used for free. But after downloading and installing the latest version of the mxODBC stuff, it was apparent that I needed a license key. Thinking that non-profits were still getting a break, I wrote to their sales department inquiring about licenses for a non-profit organization. This is what I got back:

thank you for your enquiry about mxODBC. Unfortunately mxODBC is no longer free for non-profit organisations. The new release of mxODBC continues several years’ improvements. The change in licensing was necessary because less than 0.1% of all downloads of mxODBC led to purchases and we are sure that mxOBDC is currently being used in commercial environments without a licence. Furthermore, we know that mxODBC is often in use in environments with commercial products such as Oracle. We have, therefore, unfortunately had to introduce a compulsory licensing scheme and have also reviewed our licensing policy. Because our product is extremely competitively priced we cannot afford to give away a great many licences particularly outside of Germany as we cannot offset the donation against tax. We also have to consider the administrative overhead involved in verifying non-profit status. It is for these reasons that we have decided to stop providing mxODBC for free.

Fortunately, I had already decided to hack away on getting pyodbc to run while I was waiting for eGenix to respond. Point is, if you’re willing to keep installing headers and such, you should eventually be able to get pyodbc to compile and work under Linux. The big one for me was that I found that version 2.0.35 was the only version I got get to work with my Python 2.5 installation (not sure about other versions). Doing the sudo python setup.PY install failed everytime with 2.0.36, but 2.0.35 was fine.

As for eGenix, I am sure the mxODBC is a fine product. Their mx libraries have long been a part of the overall Python landscape and I can’t help but think that if my requirements were for a trusted ODBC connection that was continuously used in a production environment, mxODBC might be the best option. But I also can’t help but think that pyodbc and the overall FOSS-spirit of the Python community might eventually do them (eGenix) in. It’s obvious that if the pyodbc project continues to mature under its current model that it will become the way to do ODBC with Python. It’s not that I have anything against folks making money. I am, after all, a capitalist. But part of the fun of a free market is watching how the software market continues to change with competition from free software.

As a side note, I think it is interesting that the IBM client access software, while not open source, is now free.

Technorati Tags: , , ,

4 Comments so far

  1. Praveen September 20th, 2007 7:25 am

    anybody has tried to install pyodbc or pydb2 on AIX?? If so, pelase provide me the steps to be followed for installing them on AIX. It would be helpful how to configure unixODBC on AIX.

    Thnaks for you help in advance..

  2. Jobin Augustine February 2nd, 2008 4:28 am

    Very Helpful article for OSS workers like me.
    pyodbc still maturing. Linux support is still a problem area. i too tried to compile it. but no luck so far

  3. João Rodrigues February 25th, 2008 12:53 pm

    Hello! I stumbled upon this post when browsing the web for installation tips for pyodbc. However, it turned out my installation ran quite smoothly on my Ubuntu box. I required only to install ODBC (a simple apt-get solved it) and then run sudo python setup.py build / install.

    Hope this helps anyone :)

    Cheers!

  4. Lucas April 23rd, 2008 3:36 pm

    You can use ceODBC on linux just like you would pyodbc.
    The have binary for windows, and linux. They support python 2.4 + 2.5

Leave a reply

For spam filtering purposes, please copy the number 8624 to the field below: