[Zope] Database Adapter For Windows DB

Baiju M mbaiju at zeomega.net
Wed Apr 15 13:00:53 EDT 2009

On Tue, Apr 14, 2009 at 1:22 AM, Andreas Jung <lists at zopyx.com> wrote:
> On 13.04.2009 23:33 Uhr, Bobby wrote:
>> Hi,

>> I'm running Zope on a Linux box and need to connect to a Window's SQL
>> Server machine. Which Zope's DB Adapter should I use? Thanks.
> mxODBC

Here is a free (as in freedom) software created by Andreas Jung:


You will be required to install:

1. "SQLAlchemy" (Object Relational Mapper)

    More details about using M$ SQL Server with SQLAlchemy:

2. "pyodbc" (Python DB API 2.0 compatible module)

3. "FreeTDS" (ODBC Driver for M$ SQL Server)

4. "unixODBC" (ODBC Manager)

Well, it's all very easy to setup.  More detailed steps:

1. Install Python

2. Install unixODBC

   While configuring unixODBC use "--disable-gui" option::

     $ ./configure --prefix=/path/to/usr --disable-gui

3. Install FreeTDS

     While installing FreeTDS use these options::

       $ ./configure --prefix=/path/to/usr --with-tdsver=8.0

4. Configure "odbc.ini"

   In the "/path/to/usr/etc/odbc.ini" file, add something like

     first_db = MS SQL Server

     Driver = FreeTDS
     Description = My First Database
     Trace = No
     Server =
     Port = 1433
     Database = test_database

5. Configure "odbcinst.ini"

     Description = v0.68 with protocol v8.0
     Driver = /path/to/usr/lib/libtdsodbc.so
     UsageCount = 1

5. Set environment variables


   To test your connection:

     /path/to/usr/bin/isql first_db username password

6. Isstall "pyodbc"

   (Refer: http://www.easysoft.com/developer/languages/python/pyodbc.html)

   Here is some relevant text:

   To build pyodbc against unixODBC, you need to tell the compiler
   and linker where to find the unixODBC include files and
   libraries. To do this, open setup.py in a text editor and find
   these lines:

     extra_compile_args = None
     extra_link_args    = None

   Edit the second line so that it looks likes this:

     extra_compile_args = None
     extra_link_args    = ['-L/path/to/usr/lib']

   Find this line:

     extra_compile_args = ['-Wno-write-strings']

   Edit the line so that it looks like this:

     extra_compile_args = ['-Wno-write-strings', '-I/path/to/usr/include']

7. Install SQLAlchemy
8. Install z3c.sqlalchemy

If you succeed with this, can you create a tutorial about how to do
it ? :)

Baiju M

More information about the Zope mailing list