[Zope] Re: Sybase and locale!

Dave Cole djc@itga.com.au
17 Jan 2000 15:31:25 +1100


>>>>> "hjl" == Hung Jung Lu <hungjunglu@hotmail.com> writes:

hjl> I just saw another message in the Python eGroup list regarding
hjl> Sybase installation problem with the locale. I had the same
hjl> problem while dealing with Sybase on Zope. So I guess I'd post my
hjl> own message again here, together with the other person's
hjl> message. In short, when installing Sybase on Linux machines, MAKE
hjl> SURE THAT YOU HAVE THE RIGHT LOCALE INFO IN YOUR locales.dat
hjl> FILE. I guess in the Zope Sybase README.txt file (both on-line
hjl> and in the distribution)

hjl> http://www.zope.org/Products/DA/SybaseDA/README.txt

Hmmm...  I just had a look at the Zope Sybase stuff.  If I had known
that SybaseDA existed, I probably would not have written my module.  I
had been using Python for less than a month when I wrote my module,
(same goes for Sybase).

hjl> it would be a good idea to add a line of comment regarding the
hjl> locale. (As simple as asking the user to double check the locale
hjl> environment variable LC_ALL, and make sure that his/her
hjl> locales.dat file includes the right locale name for his/her
hjl> machine platform.)

hjl> (A side comment: Dave Cole just release a new Python Sybase
hjl> module, and his version is 0.4

hjl> http://www.egroups.com/group/python-list/75697.html?
hjl> http://www.itga.com.au/~djc/sybase.html

hjl> I don't know whether there is a duplication of effort here. But
hjl> it would be good if Digicool and Dave could coordinate a bit.

Looking at the Digicool module, they were a lot more clever than me.
They did a fairly thin C wrapper on top of the relevant Sybase
libraries, then implemented all of the higher level code to drive the
libraries in Python.  I wish I had been that clever.

hjl> As I am having some glitches using Sybase from Zope, I may
hjl> attempt to access Sybase directly from Python.)

If my stuff does not work, you have to play with C code.  If the Zope
stuff does not work, you can play with the Python code quite a bit to
hopefully make it work.

>> I do not know if this has been said in any of these two groups
>> before, but here's a bit of advice: If you try to compile ctsybase
>> python module to use with Sybase under Linux (or any other OS, for
>> that matter) and get a core dump when you try to import it (doesn't
>> matter if it's statically linked or a dynamic module), make sure
>> your locale (LC_ALL env.  variable) is available in sybase's
>> locales file (locales/locales.dat). It took me some three hours
>> yesterday night to locate the problem (thanks, redhat, for
>> stripping the python executable and cut the way to valuable
>> debugging information :-)). If your locale is not available, either
>> change locale or add it to the locales file as an ``alias''.

After playing around with ctsybase module for a while I decided to
build my own.  I had fixed up a couple of problems in ctsybase, and
was still getting seg-faults.

I also needed to have bulkcopy capability, and realised that it would
not be too hard to start again from the example code that Sybase
provide.

- Dave