Maciej Szymonowicz
Maciej Szymonowicz

Reputation: 623

Issues with Diacritical Characters in SQL Query Using FreeTDS and pyodbc on Rocky Linux 8

I am encountering a problem with SQL queries containing diacritical characters while using FreeTDS and pyodbc to connect to a Sybase database on different server environments. Here are the details:

Environment 1:

Environment 2:

Issue:

  1. The same Python script, which executes an SQL query containing diacritical characters, works correctly on the CentOS 6 server when run against the same database.
  2. On the Rocky Linux 8 server, the script fails with the following error:
('42000', "[42000] [FreeTDS][SQL Server]Unclosed quote before the character string ','.\n (105) (SQLExecDirectW)")
  1. If I remove the diacritical characters but keep the rest of the comment, the SQL query executes correctly on the Rocky Linux 8 server.

Below is the content of the file /etc/freetds.conf on the Rocky Linux 8 server:

#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".

# Global settings are overridden by those in a database
# server specific section
[global]
        # TDS protocol version
        tds version = auto

        # Whether to write a TDSDUMP file for diagnostic purposes
        # (setting this to /tmp is insecure on a multi-user system)
;       dump file = /tmp/freetds.log
;       debug flags = 0xffff

        # Command and connection timeouts
;       timeout = 10
;       connect timeout = 10

        # To reduce data sent from server for BLOBs (like TEXT or
        # IMAGE) try setting 'text size' to a reasonable limit
;       text size = 64512

        # If you experience TLS handshake errors and are using openssl,
        # try adjusting the cipher list (don't surround in double or single quotes)
        # openssl ciphers = HIGH:!SSLv2:!aNULL:-DH

# A typical Sybase server
[egServer50]
        host = symachine.domain.com
        port = 5000
        tds version = 5.0

# A typical Microsoft server
[egServer73]
        host = ntmachine.domain.com
        port = 1433
        tds version = 7.3

Here's the content of the file /etc/freetds.conf on the CentOS 6 server:

#   $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".

# Global settings are overridden by those in a database
# server specific section
[global]
        # TDS protocol version
;       tds version = 4.2

        # Whether to write a TDSDUMP file for diagnostic purposes
        # (setting this to /tmp is insecure on a multi-user system)
;       dump file = /tmp/freetds.log
;       debug flags = 0xffff

        # Command and connection timeouts
;       timeout = 10
;       connect timeout = 10

        # If you get out-of-memory errors, it may mean that your client
        # is trying to allocate a huge buffer for a TEXT field.
        # Try setting 'text size' to a more reasonable limit
        text size = 64512

# A typical Sybase server
[egServer50]
        host = symachine.domain.com
        port = 5000
        tds version = 5.0

# A typical Microsoft server
[egServer70]
        host = ntmachine.domain.com
        port = 1433
        tds version = 7.0

Section from the /etc/odbcinst.ini file:

[TDS-ASE]
Description=Sybase ODBC TDS Driver
Driver=/usr/lib64/libtdsodbc.so.0
Setup=/usr/lib64/libtdsS.so.2
TDS_Version=5
UsageCount=3
CPTimeout=
CPReuse=

Has anyone experienced similar issues or can suggest a solution to ensure the query with diacritical characters works correctly on Rocky Linux 8? Any insights on the differences in FreeTDS configurations that might be causing this would be highly appreciated.

Upvotes: 0

Views: 59

Answers (0)

Related Questions