database conector

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


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

http://www.linuxgazette.com/issue18/sybase.html


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
their
Client-Library (CT-Lib) for Linux. Greg Thain (thain at ntdev1.sunquest.com)
has
converted the libraries to ELF. As a result, anyone using an elf-based Linux
later
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
http://reality.sgi.com/pablo/Sybase_FAQ/Q9.17.html, and the libraries
themselves can be downloaded from:

   ftp://mudshark.sunquest.com/pub/ctlib-linux-elf/ctlib-linux-elf.tgz.

...

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:
   http://www.sybase.com/products/system11/workplace/ntpromofrm.html
...
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
http://www.phpbuilder.com/columns/alberto20000919.php3?print_mode=1
which also mentions alternatives such as "FreeTDS" and ODBC.  You
can presumably "net out" the PHP-isms and Pythonize the ideas:-).


Alex






More information about the Python-list mailing list