Character set conversion issue when opening a Sybase-ASE connection from Python

I’m at a loss, I’m trying to connect to a Sybase-ASE database from a Python class.

First some version numbers:

  • Python – 2.7 (Anaconda 2.1.0 64-bit build)
  • Python Sybase library – python-sybase 0.40pre2 (Included in Anaconda)
  • Sybase – ASE 12.5.4
  • Linux – Red Hat 4.4.7-1
  • Shell – Bash 3.2.25(1)-release (x86_64-redhat-linux-gnu) (LANG=en_GB.UTF-8)
  • Pycharm – Community Edition 4.0.4

The code fails from the command line (irrespective of a character encoding being set or not) and fails within Pycharm too.

I’m executing this line of code:

db = Sybase.connect(server, username, password, database)

All the credentials are legitimate and work elsewhere, but the error message I get is this:

Sybase.DatabaseError: Msg 2401, Level 11, State 2
Character set conversion is not available between client character set 'utf8' and server character set 'iso_1'.
Msg 2411, Level 10, State 1
No conversions will be done.

My Google-fu suggests that this is just a warning and can be ignored, however I still need the result of the call to open a cursor to access the DB.

I have no control over the database server config. Is there something I can set locally in the Python or python-sybase library prior to initial connection to alleviate this problem?


Source: bash

Leave a Reply