{"action":"created","issue":{"url":"https://api.github.com/repos/pymssql/pymssql/issues/535","repository_url":"https://api.github.com/repos/pymssql/pymssql","labels_url":"https://api.github.com/repos/pymssql/pymssql/issues/535/labels{/name}","comments_url":"https://api.github.com/repos/pymssql/pymssql/issues/535/comments","events_url":"https://api.github.com/repos/pymssql/pymssql/issues/535/events","html_url":"https://github.com/pymssql/pymssql/issues/535","id":308142103,"node_id":"MDU6SXNzdWUzMDgxNDIxMDM=","number":535,"title":"pymssql won't allow connection with specific security restrictions","user":{"login":"jcollard","id":3529380,"node_id":"MDQ6VXNlcjM1MjkzODA=","avatar_url":"https://avatars3.githubusercontent.com/u/3529380?v=4","gravatar_id":"","url":"https://api.github.com/users/jcollard","html_url":"https://github.com/jcollard","followers_url":"https://api.github.com/users/jcollard/followers","following_url":"https://api.github.com/users/jcollard/following{/other_user}","gists_url":"https://api.github.com/users/jcollard/gists{/gist_id}","starred_url":"https://api.github.com/users/jcollard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcollard/subscriptions","organizations_url":"https://api.github.com/users/jcollard/orgs","repos_url":"https://api.github.com/users/jcollard/repos","events_url":"https://api.github.com/users/jcollard/events{/privacy}","received_events_url":"https://api.github.com/users/jcollard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-23T18:49:27Z","updated_at":"2019-10-14T05:50:44Z","closed_at":null,"author_association":"NONE","body":"I'm trying to connect to a database in Azure using `pymsql`. I've been successful in connecting to other databases in Azure but this one seems particularly finicky.\r\n\r\nHere is the working tsql command:\r\n\r\n`tsql -p 1433 -S server.database.windows.net -P 'password' -U username@server -D database_name`\r\n\r\nHere is the failing pymsql connection call:\r\n\r\n    pymssql.connect(server='server.database.windows.net',\r\n                    port=1433,\r\n                    user='username@server',\r\n                    password='password',\r\n                    database='database_name')\r\n\r\nHere is the error trace:\r\n\r\n    Traceback (most recent call last):\r\n      File \"pymssql.pyx\", line 635, in pymssql.connect (pymssql.c:10734)\r\n      File \"_mssql.pyx\", line 1902, in _mssql.connect (_mssql.c:21821)\r\n      File \"_mssql.pyx\", line 637, in _mssql.MSSQLConnection.__init__ (_mssql.c:6581)\r\n      File \"_mssql.pyx\", line 1630, in _mssql.maybe_raise_MSSQLDatabaseException (_mssql.c:17524)\r\n    _mssql.MSSQLDatabaseException: (20002, b'DB-Lib error message 20002, severity 9:\\nAdaptive Server connection failed\\n')\r\n    \r\n    During handling of the above exception, another exception occurred:\r\n    \r\n    Traceback (most recent call last):\r\n      File \"smallest.py\", line 6, in <module>\r\n        database='database_name')\r\n      File \"pymssql.pyx\", line 641, in pymssql.connect (pymssql.c:10824)\r\n    pymssql.OperationalError: (20002, b'DB-Lib error message 20002, severity 9:\\nAdaptive Server connection failed\\n')\r\n\r\nSomething of note:\r\n\r\nI am specifically restricted to the `database_name` and the `tsql` command will fail with the same error code `20002` as `pymsql` without the `-D database_name` flag. This leads me to believe that `pymsql` may not be passing this properly but I'm not sure how I would check this.\r\n\r\nBelow are dumps generated by:\r\n\r\n        os.environ['TDSDUMPCONFIG'] = 'config'\r\n        os.environ['TDSDUMP'] = 'dump'\r\n\r\nI believe the important part from the above is this line:\r\n\r\n`login.c:466:login packet rejected`\r\n\r\nSeems to suggest an invalid credentials.\r\n\r\nAny help is appreciated.\r\n\r\n`TDSDUMPCONFIG`:\r\n<pre>\r\nlog.c:196:Starting log file for FreeTDS 0.91\r\n        on 2018-03-23 18:31:34 with debug flags 0x4fff.\r\nconfig.c:185:Getting connection information for [server:1433].\r\nconfig.c:189:Attempting to read conf files.\r\nconfig.c:354:... $FREETDSCONF not set.  Trying $FREETDS/etc.\r\nconfig.c:367:... $FREETDS not set.  Trying $HOME.\r\nconfig.c:293:Could not open '/home/ubuntu/.freetds.conf' ((.freetds.conf)).\r\nconfig.c:297:Found conf file '/etc/freetds/freetds.conf' (default).\r\nconfig.c:483:Looking for section global.\r\nconfig.c:540:   Found section global.\r\nconfig.c:543:Got a match.\r\nconfig.c:565:   tds version = '7.1'\r\nconfig.c:788:Setting tds version to 7.1 (0x701) from $TDSVER.\r\nconfig.c:565:   text size = '64512'\r\nconfig.c:540:   Found section egserver50.\r\nconfig.c:540:   Found section egserver70.\r\nconfig.c:540:   Found section server.\r\nconfig.c:554:   Reached EOF\r\nconfig.c:483:Looking for section server:1433.\r\nconfig.c:540:   Found section global.\r\nconfig.c:540:   Found section egserver50.\r\nconfig.c:540:   Found section egserver70.\r\nconfig.c:540:   Found section server.\r\nconfig.c:554:   Reached EOF\r\nconfig.c:303:[server:1433] not found.\r\nconfig.c:354:... $FREETDSCONF not set.  Trying $FREETDS/etc.\r\nconfig.c:367:... $FREETDS not set.  Trying $HOME.\r\nconfig.c:293:Could not open '/home/ubuntu/.freetds.conf' ((.freetds.conf)).\r\nconfig.c:297:Found conf file '/etc/freetds/freetds.conf' (default).\r\nconfig.c:483:Looking for section global.\r\nconfig.c:540:   Found section global.\r\nconfig.c:543:Got a match.\r\nconfig.c:565:   tds version = '7.1'\r\nconfig.c:788:Setting tds version to 7.1 (0x701) from $TDSVER.\r\nconfig.c:565:   text size = '64512'\r\nconfig.c:540:   Found section egserver50.\r\nconfig.c:540:   Found section egserver70.\r\nconfig.c:540:   Found section server.\r\nconfig.c:554:   Reached EOF\r\nconfig.c:483:Looking for section server.\r\nconfig.c:540:   Found section global.\r\nconfig.c:540:   Found section egserver50.\r\nconfig.c:540:   Found section egserver70.\r\nconfig.c:540:   Found section server.\r\nconfig.c:543:Got a match.\r\nconfig.c:565:   host = 'server.database.windows.net'\r\nconfig.c:595:Found host entry server.database.windows.net.\r\nconfig.c:599:IP addr is ser.ver.ip.add.\r\nconfig.c:565:   port = '1433'\r\nconfig.c:565:   tds version = '7.1'\r\nconfig.c:788:Setting tds version to 7.1 (0x701) from $TDSVER.\r\nconfig.c:554:   Reached EOF\r\nconfig.c:301:Success: [server] defined in /etc/freetds/freetds.conf.\r\nconfig.c:714:Setting 'dump_file' to 'dump' from $TDSDUMP.\r\nconfig.c:650:tds_config_login: client_charset is UTF-8.\r\nconfig.c:655:tds_config_login: database_name is database_name.\r\nconfig.c:224:Final connection parameters:\r\nconfig.c:225:            server_name = server:1433\r\nconfig.c:226:       server_host_name = server.database.windows.net\r\nconfig.c:227:                ip_addr = ser.ver.ip.add\r\nconfig.c:228:          instance_name = \r\nconfig.c:229:                   port = 1433\r\nconfig.c:230:          major_version = 7\r\nconfig.c:231:          minor_version = 1\r\nconfig.c:232:             block_size = 0\r\nconfig.c:233:               language = us_english\r\nconfig.c:234:         server_charset = \r\nconfig.c:235:        connect_timeout = 0\r\nconfig.c:236:       client_host_name = ubuntu-xenial\r\nconfig.c:237:         client_charset = UTF-8\r\nconfig.c:238:               app_name = pymssql=2.1.3\r\nconfig.c:239:              user_name = \r\nconfig.c:242:                library = DB-Library\r\nconfig.c:243:              bulk_copy = 0\r\nconfig.c:244:      suppress_language = 0\r\nconfig.c:245:          encrypt level = 0\r\nconfig.c:246:          query_timeout = 0\r\nconfig.c:249:               database = database_name\r\nconfig.c:250:              dump_file = dump\r\nconfig.c:251:            debug_flags = 0\r\nconfig.c:252:              text_size = 64512\r\nconfig.c:253:           broken_dates = 0\r\nconfig.c:254:     emul_little_endian = 0\r\nconfig.c:255:      server_realm_name = \r\n</pre>\r\n\r\n\r\n`TDSDUMP`\r\n<pre>\r\nlog.c:196:Starting log file for FreeTDS 0.91\r\n\ton 2018-03-23 18:31:34 with debug flags 0x4fff.\r\nconfig.c:714:Setting 'dump_file' to 'dump' from $TDSDUMP.\r\niconv.c:330:tds_iconv_open(0x2a88150, UTF-8)\r\niconv.c:187:local name for ISO-8859-1 is ISO-8859-1\r\niconv.c:187:local name for UTF-8 is UTF-8\r\niconv.c:187:local name for UCS-2LE is UCS-2LE\r\niconv.c:187:local name for UCS-2BE is UCS-2BE\r\niconv.c:349:setting up conversions for client charset \"UTF-8\"\r\niconv.c:351:preparing iconv for \"UTF-8\" <-> \"UCS-2LE\" conversion\r\niconv.c:391:preparing iconv for \"ISO-8859-1\" <-> \"UCS-2LE\" conversion\r\niconv.c:394:tds_iconv_open: done\r\nnet.c:207:Connecting to 104.42.238.205 port 1433 (TDS version 7.1)\r\nnet.c:272:tds_open_socket: connect(2) returned \"Operation now in progress\"\r\nnet.c:312:tds_open_socket() succeeded\r\nutil.c:156:Changed query state from DEAD to IDLE\r\nnet.c:743:Sending packet\r\n*************************** BINARY DATA OMITTED\r\n\r\nnet.c:557:Received header\r\n*************************** BINARY DATA OMITTED\r\n\r\n\r\nnet.c:611:Received packet\r\n*************************** BINARY DATA OMITTED\r\n\r\nlogin.c:1057:detected flag 3\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Allocating epoch #0\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_constate.c:596\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Allocating epoch #1\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_128_GCM_SHA256 (C0.2B)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_256_GCM_SHA384 (C0.2C)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_CAMELLIA_128_GCM_SHA256 (C0.86)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_CAMELLIA_256_GCM_SHA384 (C0.87)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_128_CBC_SHA1 (C0.09)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_128_CBC_SHA256 (C0.23)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_256_CBC_SHA1 (C0.0A)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_256_CBC_SHA384 (C0.24)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_CAMELLIA_128_CBC_SHA256 (C0.72)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_CAMELLIA_256_CBC_SHA384 (C0.73)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_128_CCM (C0.AC)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_AES_256_CCM (C0.AD)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_ECDSA_3DES_EDE_CBC_SHA1 (C0.08)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_AES_128_GCM_SHA256 (C0.2F)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_AES_256_GCM_SHA384 (C0.30)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_CAMELLIA_128_GCM_SHA256 (C0.8A)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_CAMELLIA_256_GCM_SHA384 (C0.8B)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_AES_128_CBC_SHA1 (C0.13)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_AES_128_CBC_SHA256 (C0.27)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_AES_256_CBC_SHA1 (C0.14)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_AES_256_CBC_SHA384 (C0.28)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_CAMELLIA_128_CBC_SHA256 (C0.76)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_CAMELLIA_256_CBC_SHA384 (C0.77)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_ECDHE_RSA_3DES_EDE_CBC_SHA1 (C0.12)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_128_GCM_SHA256 (00.9C)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_256_GCM_SHA384 (00.9D)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_CAMELLIA_128_GCM_SHA256 (C0.7A)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_CAMELLIA_256_GCM_SHA384 (C0.7B)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_128_CBC_SHA1 (00.2F)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_128_CBC_SHA256 (00.3C)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_256_CBC_SHA1 (00.35)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_256_CBC_SHA256 (00.3D)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_CAMELLIA_128_CBC_SHA1 (00.41)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_CAMELLIA_128_CBC_SHA256 (00.BA)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_CAMELLIA_256_CBC_SHA1 (00.84)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_CAMELLIA_256_CBC_SHA256 (00.C0)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_128_CCM (C0.9C)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_AES_256_CCM (C0.9D)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_RSA_3DES_EDE_CBC_SHA1 (00.0A)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_128_GCM_SHA256 (00.9E)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_256_GCM_SHA384 (00.9F)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_CAMELLIA_128_GCM_SHA256 (C0.7C)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_CAMELLIA_256_GCM_SHA384 (C0.7D)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_128_CBC_SHA1 (00.33)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_128_CBC_SHA256 (00.67)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_256_CBC_SHA1 (00.39)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_256_CBC_SHA256 (00.6B)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_CAMELLIA_128_CBC_SHA1 (00.45)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_CAMELLIA_128_CBC_SHA256 (00.BE)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_CAMELLIA_256_CBC_SHA1 (00.88)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_CAMELLIA_256_CBC_SHA256 (00.C4)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_128_CCM (C0.9E)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_AES_256_CCM (C0.9F)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Keeping ciphersuite: GNUTLS_DHE_RSA_3DES_EDE_CBC_SHA1 (00.16)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Sending extension STATUS REQUEST (5 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Sending extension SAFE RENEGOTIATION (1 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Sending extension SESSION TICKET (0 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Sending extension SUPPORTED ECC (12 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Sending extension SUPPORTED ECC POINT FORMATS (2 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (4.1) RSA-SHA256\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (4.3) ECDSA-SHA256\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (5.1) RSA-SHA384\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (5.3) ECDSA-SHA384\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (6.1) RSA-SHA512\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (6.3) ECDSA-SHA512\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (3.1) RSA-SHA224\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (3.3) ECDSA-SHA224\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (2.1) RSA-SHA1\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: sent signature algo (2.3) ECDSA-SHA1\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Sending extension SIGNATURE ALGORITHMS (22 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: CLIENT HELLO was queued [219 bytes]\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: enqueued [CLIENT HELLO] 219. Total 219 bytes.\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE FLUSH: 219 bytes in buffer.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Preparing Packet Handshake(22) with length: 219 and min pad: 0\r\nnet.c:1259:GNUTLS: level 9:\r\n  ENC[0x2b43c30]: cipher: NULL, MAC: MAC-NULL, Epoch: 0\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE: enqueued 224 bytes for 0x2a88150. Total 224 bytes.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Sent Packet[1] Handshake(22) in epoch 0 and length: 224\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: wrote 1 bytes, 0 bytes left.\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE FLUSH: 224 bytes in buffer.\r\nnet.c:1242:in tds_push_func\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE: wrote 224 bytes, 0 bytes left.\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1154\r\nnet.c:1201:in tds_pull_func\r\nnet.c:743:Sending packet\r\n*************************** BINARY DATA OMITTED\r\n\r\nnet.c:1214:have 0\r\nnet.c:1218:before read\r\nnet.c:557:Received header\r\n*************************** BINARY DATA OMITTED\r\n\r\n\r\nnet.c:611:Received packet\r\n*************************** BINARY DATA OMITTED\r\n\r\nnet.c:1221:after read\r\nnet.c:1214:have 4088\r\nnet.c:1225:read 5 bytes\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: Got 5 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: read 5 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Have 0 bytes into buffer. Adding 5 bytes.\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Requested 5 bytes\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: SSL 3.3 Handshake packet received. Epoch 0, length: 5788\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Expected Packet Handshake(22)\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Received Packet Handshake(22) with length: 5788\r\nnet.c:1201:in tds_pull_func\r\nnet.c:1214:have 4083\r\nnet.c:1225:read 4083 bytes\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: Got 4083 bytes from 0x2a88150\r\nnet.c:1201:in tds_pull_func\r\nnet.c:1214:have 0\r\nnet.c:1218:before read\r\nnet.c:557:Received header\r\n*************************** BINARY DATA OMITTED\r\n\r\nnet.c:611:Received packet\r\n*************************** BINARY DATA OMITTED\r\n\r\nnet.c:1221:after read\r\nnet.c:1214:have 1705\r\nnet.c:1225:read 1705 bytes\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: Got 1705 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: read 5788 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Have 5 bytes into buffer. Adding 5788 bytes.\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Requested 5793 bytes\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Decrypted Packet[0] Handshake(22) with length: 5788\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: SERVER HELLO (2) was received. Length 81[5784], frag offset 0, frag length: 81, sequence: 0\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Server's version: 3.3\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: SessionID length: 32\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: SessionID: *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Selected cipher suite: ECDHE_RSA_AES_256_CBC_SHA384\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Selected compression method: NULL (0)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Parsing extension 'STATUS REQUEST/5' (0 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  EXT[0x2b43c30]: Parsing extension 'SAFE RENEGOTIATION/65281' (1 bytes)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Safe renegotiation succeeded\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1154\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: CERTIFICATE (11) was received. Length 3523[5699], frag offset 0, frag length: 3523, sequence: 0\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1392\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1154\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: CERTIFICATE STATUS (22) was received. Length 1835[2172], frag offset 0, frag length: 1835, sequence: 0\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1392\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1154\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: SERVER KEY EXCHANGE (12) was received. Length 329[333], frag offset 0, frag length: 329, sequence: 0\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1392\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Selected ECC curve SECP256R1 (2)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: verify handshake data: using RSA-SHA1\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1154\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: SERVER HELLO DONE (14) was received. Length 0[0], frag offset 0, frag length: 1, sequence: 0\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1145\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1392\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1374\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: CLIENT KEY EXCHANGE was queued [70 bytes]\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: enqueued [CLIENT KEY EXCHANGE] 70. Total 70 bytes.\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: enqueued [CHANGE CIPHER SPEC] 1. Total 71 bytes.\r\nnet.c:1259:GNUTLS: level 4:\r\n  REC[0x2b43c30]: Sent ChangeCipherSpec\r\nnet.c:1259:GNUTLS: level 9:\r\n  INT: PREMASTER SECRET[32]: *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 9:\r\n  INT: CLIENT RANDOM[32]:  *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 9:\r\n  INT: SERVER RANDOM[32]: *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 9:\r\n  INT: MASTER SECRET: *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Initializing epoch #1\r\nnet.c:1259:GNUTLS: level 9:\r\n  INT: KEY BLOCK[160]: *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 9:\r\n  INT: CLIENT WRITE KEY [32]:  *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 9:\r\n  INT: SERVER WRITE KEY [32]: *************************** BINARY DATA OMITTED\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Epoch #1 ready\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Cipher Suite: ECDHE_RSA_AES_256_CBC_SHA384\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Initializing internal [write] cipher sessions\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: recording tls-unique CB (send)\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: FINISHED was queued [16 bytes]\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: enqueued [FINISHED] 16. Total 87 bytes.\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE FLUSH: 87 bytes in buffer.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Preparing Packet Handshake(22) with length: 70 and min pad: 0\r\nnet.c:1259:GNUTLS: level 9:\r\n  ENC[0x2b43c30]: cipher: NULL, MAC: MAC-NULL, Epoch: 0\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE: enqueued 75 bytes for 0x2a88150. Total 75 bytes.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Sent Packet[2] Handshake(22) in epoch 0 and length: 75\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: wrote 1 bytes, 17 bytes left.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Preparing Packet ChangeCipherSpec(20) with length: 1 and min pad: 0\r\nnet.c:1259:GNUTLS: level 9:\r\n  ENC[0x2b43c30]: cipher: NULL, MAC: MAC-NULL, Epoch: 0\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE: enqueued 6 bytes for 0x2a88150. Total 81 bytes.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Sent Packet[3] ChangeCipherSpec(20) in epoch 0 and length: 6\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: wrote 1 bytes, 16 bytes left.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Preparing Packet Handshake(22) with length: 16 and min pad: 0\r\nnet.c:1259:GNUTLS: level 9:\r\n  ENC[0x2b43c30]: cipher: AES-256-CBC, MAC: SHA384, Epoch: 1\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE: enqueued 101 bytes for 0x2a88150. Total 182 bytes.\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Sent Packet[1] Handshake(22) in epoch 1 and length: 101\r\nnet.c:1259:GNUTLS: level 11:\r\n  HWRITE: wrote 1 bytes, 0 bytes left.\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE FLUSH: 182 bytes in buffer.\r\nnet.c:1242:in tds_push_func\r\nnet.c:1242:in tds_push_func\r\nnet.c:1242:in tds_push_func\r\nnet.c:1259:GNUTLS: level 11:\r\n  WRITE: wrote 182 bytes, 0 bytes left.\r\nnet.c:1201:in tds_pull_func\r\nnet.c:743:Sending packet\r\n*************************** BINARY DATA OMITTED\r\n\r\nnet.c:1214:have 0\r\nnet.c:1218:before read\r\nnet.c:557:Received header\r\n*************************** BINARY DATA OMITTED\r\n\r\n\r\nnet.c:611:Received packet\r\n*************************** BINARY DATA OMITTED\r\n\r\nnet.c:1221:after read\r\nnet.c:1214:have 107\r\nnet.c:1225:read 5 bytes\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: Got 5 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: read 5 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Have 0 bytes into buffer. Adding 5 bytes.\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Requested 5 bytes\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: SSL 3.3 ChangeCipherSpec packet received. Epoch 0, length: 1\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Expected Packet ChangeCipherSpec(20)\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Received Packet ChangeCipherSpec(20) with length: 1\r\nnet.c:1201:in tds_pull_func\r\nnet.c:1214:have 102\r\nnet.c:1225:read 1 bytes\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: Got 1 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: read 1 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Have 5 bytes into buffer. Adding 1 bytes.\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Requested 6 bytes\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Decrypted Packet[1] ChangeCipherSpec(20) with length: 1\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: Cipher Suite: ECDHE_RSA_AES_256_CBC_SHA384\r\nnet.c:1259:GNUTLS: level 3:\r\n  ASSERT: gnutls_buffers.c:1154\r\nnet.c:1201:in tds_pull_func\r\nnet.c:1214:have 101\r\nnet.c:1225:read 5 bytes\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: Got 5 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: read 5 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Have 0 bytes into buffer. Adding 5 bytes.\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Requested 5 bytes\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: SSL 3.3 Handshake packet received. Epoch 0, length: 96\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Expected Packet Handshake(22)\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Received Packet Handshake(22) with length: 96\r\nnet.c:1201:in tds_pull_func\r\nnet.c:1214:have 96\r\nnet.c:1225:read 96 bytes\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: Got 96 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  READ: read 96 bytes from 0x2a88150\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Have 5 bytes into buffer. Adding 96 bytes.\r\nnet.c:1259:GNUTLS: level 10:\r\n  RB: Requested 101 bytes\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Decrypted Packet[0] Handshake(22) with length: 16\r\nnet.c:1259:GNUTLS: level 4:\r\n  HSK[0x2b43c30]: FINISHED (20) was received. Length 12[12], frag offset 0, frag length: 12, sequence: 0\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Start of epoch cleanup\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Epoch #0 freed\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: End of epoch cleanup\r\nnet.c:1352:handshake succeeded!!\r\ngssapi.c:215:kerberos name MSSQLSvc/server.database.windows.net:1433\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Start of epoch cleanup\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: End of epoch cleanup\r\nnet.c:1259:GNUTLS: level 5:\r\n  REC[0x2b43c30]: Epoch #1 freed\r\nlogin.c:466:login packet rejected\r\nutil.c:156:Changed query state from IDLE to DEAD\r\nutil.c:331:tdserror(0x2ac2c80, 0x2a88150, 20002, 0)\r\ndblib.c:7929:dbperror(0x2b1cdc0, 20002, 0)\r\ndblib.c:7981:20002: \"Adaptive Server connection failed\"\r\ndblib.c:8002:\"Adaptive Server connection failed\", client returns 2 (INT_CANCEL)\r\nutil.c:361:tdserror: client library returned TDS_INT_CANCEL(2)\r\nutil.c:384:tdserror: returning TDS_INT_CANCEL(2)\r\ndblib.c:1443:dbclose(0x2b1cdc0)\r\ndblib.c:258:dblib_del_connection(0x7f9a5e238780, 0x2a88150)\r\nmem.c:615:tds_free_all_results()\r\ndblib.c:305:dblib_release_tds_ctx(1)\r\ndblib.c:5882:dbfreebuf(0x2b1cdc0)\r\ndblib.c:739:dbloginfree(0x2a9d450)\r\n</pre>\r\n\r\nMy `tsql` setup:\r\n\r\n    $ tsql -C\r\n    Compile-time settings (established with the \"configure\" script)\r\n                                Version: freetds v0.91\r\n                 freetds.conf directory: /etc/freetds\r\n         MS db-lib source compatibility: no\r\n            Sybase binary compatibility: yes\r\n                          Thread safety: yes\r\n                          iconv library: yes\r\n                            TDS version: 7.1\r\n                                  iODBC: no\r\n                               unixodbc: yes\r\n                  SSPI \"trusted\" logins: no\r\n                               Kerberos: yes\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pymssql/pymssql/issues/comments/541510537","html_url":"https://github.com/pymssql/pymssql/issues/535#issuecomment-541510537","issue_url":"https://api.github.com/repos/pymssql/pymssql/issues/535","id":541510537,"node_id":"MDEyOklzc3VlQ29tbWVudDU0MTUxMDUzNw==","user":{"login":"shanesjm","id":33415562,"node_id":"MDQ6VXNlcjMzNDE1NTYy","avatar_url":"https://avatars2.githubusercontent.com/u/33415562?v=4","gravatar_id":"","url":"https://api.github.com/users/shanesjm","html_url":"https://github.com/shanesjm","followers_url":"https://api.github.com/users/shanesjm/followers","following_url":"https://api.github.com/users/shanesjm/following{/other_user}","gists_url":"https://api.github.com/users/shanesjm/gists{/gist_id}","starred_url":"https://api.github.com/users/shanesjm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanesjm/subscriptions","organizations_url":"https://api.github.com/users/shanesjm/orgs","repos_url":"https://api.github.com/users/shanesjm/repos","events_url":"https://api.github.com/users/shanesjm/events{/privacy}","received_events_url":"https://api.github.com/users/shanesjm/received_events","type":"User","site_admin":false},"created_at":"2019-10-14T05:50:44Z","updated_at":"2019-10-14T05:50:44Z","author_association":"NONE","body":"> @jcollard which library are you using now?\r\n@OC-SR You can use pyodbc\r\nhttps://pypi.org/project/pyodbc/ \r\nI had no option but to switch."}}
{"actor":{"display_login":"shanesjm"}}