[DB-SIG] Connecting to Microsoft SQL server from Python

Hrvoje Niksic hniksic@srce.hr
20 Sep 1999 19:34:18 +0200

In the company where I'll soon work, there is an NT machine running
Microsoft SQL Server 6.5.  Next to it is a Linux box that runs
programs that connect to the database.  I'd like to connect to the
database using Python.

At this time all the programs that connect to the database are written
in Perl, using a module that works with the Sybase development
library (ctlib).  The library connects to the Sybase driver installed
on the NT machine, which in turn connects to the MS SQL server.

This works nicely, but I'd rather use Python.  I thought the Sybase
stuff was ODBC-driven, so I tried to use mxODBC, but it wouldn't
compile -- it seems that the Sybase Linux library doesn't come with
the ODBC API.  I tried Peter Godman's Sybase module, but it didn't
seem usable.

I guess I could write a new module from scratch based on the Perl
module, but that would take a lot of time, as I know very little about
the Python internals.

So, my questions are:

* Is there an ODBC library that can connect to the Microsoft SQL
  server on a remote machine?  Does mxODBC work with it?

* Is there a Python module that can connect to the Microsoft SQL
  server, with or without ODBC?

* Is there another way to approach the problem?

Help would be *much* appreciated.  I'd hate spend several years of my
life coding Perl, or having to write wrappers around Perl functions in
order to use them from Python.