Sybase DB-Client module searched

Paul Boddie paulb at infercor.no
Wed Oct 11 06:32:14 EDT 2000


Daniel Hops wrote:
> 
> I am looking for a python module to let me connect to a sybase 11
> server.
> I already downloaded ctsybasemodule0.1b-r4, but I don't understand how
> to install it.
> It looks like I have to recompile python to get it working, which is not
> very easy, as our Sysops
> dont support python and I had to fight to install it in my /home dir.

Well, I don't think I ever had to fight to install python, although you may be
referring to your fight for the right to install it. ;-)

> Isn't there any other choice or other module which lets me contact
> sybase servers?

There are other modules, such as mxODBC, although you will need some ODBC
middleware if you plan to take this route on UNIX. See:

  http://www.paul.boddie.net/Python/mxODBC.html

It may be the case that you would need root access to install some of the
middleware packages, however.

Back to ctsybasemodule:

> The passage that I dont understand / which dont works follows (I think
> it has to be used in the
> compilation process of python). Isnt there any option for which I dont
> have to recompile python?
> "To install ctsybasemodule, add a line like the following to your
> modules/Setup
> file.
> 
> ctsybase dbi.c ctsybasemodule.c -I$(SYBASE)/include -L$(SYBASE)/lib
> -lblk -l
> ct -lcs -lsytcl -lcomn -lintl -ltli # -linsck
> 
> Recompile python, and you should be all set.  I don't know if this
> module
> works as a dynamically loadable module.  I'd love to hear about it one
> way or the other. "

The answer is found in the Makefile.pre.in file:

# Short Instructions
# ------------------

# 1. Build and install Python (1.5 or newer).
# 2. "make -f Makefile.pre.in boot"
# 3. "make"
# You should now have a shared library.

I think you need to change the Setup.in file so that SYBASE refers to your
Sybase directory. Also in that file, I needed to change the "link line" so that
the appropriate (Sybase Adaptive Server Enterprise 11.5) libraries are
referenced when building the shared library:

ctsybase dbi.c ctsybasemodule.c -I$(SYBASE)/include -L$(SYBASE)/lib \
        -lblk -lct -lcs -ltcl -lcomn -lintl -ltli # -linsck

Remember that this is ctsybasemodule's Setup.in file, not Python's.

Now, follow the above "Short Instructions" (from step 2) and you might have
ctsybasemodule.so in your ctsybasemodule directory. Just make sure that that
directory is in your PYTHONPATH, invoke Python, and try and import ctsybase. You
may need to make sure that the Sybase libraries are found in your
LD_LIBRARY_PATH too.

I hope that this helps!

Regards,

Paul



More information about the Python-list mailing list