zillow / ctds

Python DB-API 2.0 library for MS SQL Server
MIT License
84 stars 12 forks source link

_tds.OperationalError with locally built FreeTDS #70

Closed kafran closed 4 years ago

kafran commented 4 years ago

@joshuahlang can you help me?

I'm trying to locally build FreeTDS on a Docker container but I'm getting _tds.OperationalError: Adaptive Server connection failed when trying with ctds. tsql give me this:

root@a5a8e27c1c10:/# tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.1.33
             freetds.conf directory: /usr/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: no
                        TDS version: auto
                              iODBC: no
                           unixodbc: no
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: yes
                             GnuTLS: no
                               MARS: yes

I thought it could be something with iconv, so I disabled it.

root@a5a8e27c1c10:/# tsql -H 10.209.42.30 -p 1433 -U "user" -v
Password: 
locale is "C.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20017 (severity 9):
    Unexpected EOF from the server
Error 20002 (severity 9):
    Adaptive Server connection failed
Error 20002 (severity 9):
    Adaptive Server connection failed
There was a problem connecting to the server

Do you know what it could be? I think it is missing some library. If I install the system's package freetds-dev it works, but since its Debian its an old one.

kafran commented 4 years ago

Never mind, I found the error. I should have specified the protocol version 7.0. I don't know why with system's FreeTDS I don't need to do this.

kafran commented 4 years ago

I really don't know what is going on. With Conda's FreeTDS it works on 7.4; But if I compile FreeTDS it only works with TDS 7.0.

kafran commented 4 years ago

Still trying to comprehend the problem. This workaround works for me: https://github.com/FreeTDS/freetds/issues/299

kafran commented 4 years ago

This seem to be related to openssl version https://github.com/FreeTDS/freetds/issues/336. I'm compiling with GnuTLS as a workaround.