Thursday, April 14, 2005

Database adapter trouble in Zope land

My company recently worked out an agreement with Oracle to port some of our products to the Oracle Database and I was assigned to the project. After examining the involved applications, I was happy to find out that the changes to the SQL used in them were few and prepared myself to do the work and finish it as soon as possible.

It turns out that the work was harder than expected, not because of the code, but because of the lack of a decent adapter for the Oracle Database. We need to use Oracle 10g for this project and DCOracle2, the only Zope DA that can work with a version of oracle higher than 7, is not being developed at the moment and the last update came in 2003. That means it doesn't work with versions of Oracle greater than 8. Well, according to what some people say on the mailing lists it can be made to work, but you have to tinker with the make file.

I am not sure I want to invest a lot of time fighting with the DCOracle2 setup, specially since opinions at the Zope DB mailing list lead me to believe that it is somewhat buggy and has trouble supporting some features. There is another adapter for Python, cx_oracle, and this one works with Oracle 10, but there is no DB adapter for Zope. I decided I would at least find out how hard it would be to write a Zope DA for cx_oracle, but it turns out that there is almost no information on that subject. If you search the zope.org site you get no results for this (which is kind of odd because the one article that I finally found was there), but if you are patient and dig into the mailing lists you can find an introduction to writing a DA, authored (I think) by Chris Petrilli. These seems to be the only information available on the subject.

I decided writing my own DA would not be a good idea for this project, given my time constraints, so my other option is to use an ODBC adapter instead. There is a ZODBC adapter available from Zope, but it is Windows only and also unmaintained. The only other option is mxODBC Zope DA, a commercial adapter by Egenix. It seems to be a good solution to the problem, but it requires an existing ODBC driver. That's certainly no problem in Windows, but for Linux you probably need another commercial product, so the cost is not small.

Anyway, we'll have to make a decision this week, so maybe we'll have to go the commercial route. I just thought by now Zope would have better solutions for this problem, so I am a bit disappointed. Part of the problem is the fact that even if there is an adequate open source solution for Python (which is the case here with Oracle but not with ODBC), there still needs to be a separate solution written for Zope's DA interface. Of course if we use a DA we get automatic transaction support and more from Zope's machinery, so I can't really complain, since I could theoretically modify my software to work directly from Python without using Zope's DAs (but if that's worth it, why use Zope at all?). Also, given that Zope Corporation is a consulting company, they have a lot of pressure to make their developers work on tools that their clients require, not on community member wishes, so I totally understand their decision to stop supporting DA's.

0 Comments:

Post a Comment

<< Home