database conector

Alex Martelli aleax at
Tue Sep 4 17:16:33 CEST 2001

"Charles" <charles at> wrote in message
news:mailman.999530042.10557.python-list at
> I need connect a python apps linux to a microsoft sql server via tcp.
> anyone has a ideia ?

Quoting selectively:

Linux can connect to Sybase SQL Server. What's more, it can also connect to
Microsoft SQL Server. Some time ago, Sybase released an a.out version of
Client-Library (CT-Lib) for Linux. Greg Thain (thain at
converted the libraries to ELF. As a result, anyone using an elf-based Linux
than 2.0 should be able to link applications against these libraries.
There's a nice
section on this issue that's available in the Sybase FAQ, at, and the libraries
themselves can be downloaded from:


I've used these libraries with the Sybase System 11 we have running at work
on a Solaris 2.4 system, and the examples for this article were developed
using Microsoft SQL Server 6.0 running on Windows NT 4.0. If you don't have
SQL Server, but would like to experiment, you can download an evaluation
version of SQL Server Professional for Windows NT at:
In order to make use of these examples, you need to have been assigned a
user id and password on the SQL Server to which you will connect. You should
also know the hostname of the server, and most importantly, the port on
which the server listens.
The first thing to tackle is the installation and configuration of the
Client-Library distribution. The ctlib-linux-elf.tar.gz file includes a
top-level sybase directory. Before you extract it, you should probably pick
a permanent home for it; common places are /opt or /usr/local. When you
extract it, you should be sure that you are root, and make sure your working
directory is the directory that you've chosen. The process might look
something like this:

Etc, etc.  You'll presumably need to wrap ctlib-linux to be able
to use it from Python, but that may be easy with SWIG, or maybe
somebody else has already done the hard work.

There's also a PHP-oriented article at
which also mentions alternatives such as "FreeTDS" and ODBC.  You
can presumably "net out" the PHP-isms and Pythonize the ideas:-).


More information about the Python-list mailing list