1

I try to connect Azure SQL using python, but get next error:

File "pymssql.pyx", line 641, in pymssql.connect (pymssql.c:10824)
pymssql.OperationalError: (20002, 'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (myserver:1433)\n')

freetds.conf:

[global]
        # TDS protocol version
        tds version = 7.4

        # 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

If I try connect use tsql - connect success!

I try recompiled freetds with params:

./configure --enable-msdblib --enable-threadsafe --enable-sybase-compat --with-tdsver=7.4 --with-openssl=/usr/bin

I'm using this manual https://msdn.microsoft.com/en-us/library/mt694094(v=sql.1).aspx

Alximik
  • 151
  • 1
  • 7

2 Answers2

0

@Alximik Per my experience, I don't think recompiling freetds by self is necessary. For the issue, I think the issue was caused by your configuration for freetds.conf, please see my answer for the solved SO thread pymssql: Connection to the database only works sometimes and the sample configuration content below.

host = <database_name>.database.windows.net
port = 1433
tds version = 7.3

Meanwhile, you can refer to http://www.freetds.org/userguide/freetdsconf.htm to configure it.

Community
  • 1
  • 1
Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • Thank you for your answer, but it not solve my problem. I solve it after make from source pymssql and freetds (with option in previous post and set tds version=7.3 in global config) – Alximik Jul 01 '16 at 17:05
  • @Alximik Thanks for your sharing. – Peter Pan Jul 03 '16 at 08:20
0

I solve it after make from source pymssql and freetds (with option in previous post and set tds version=7.3 in global config). Pymssql make from source use command "python setup.py build" and next for install in system "python setup.py install"

Alximik
  • 151
  • 1
  • 7