I am trying to use FreeTDS to connect from a Linux server (RHEL v7) to a separate server running MS SQL Server 2014. However, when attempting to connect with tsql I get the following errors (error message differs depending on whether I include username and password):

$ tsql -S MYSERVER
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20002 (severity 9):
        Adaptive Server connection failed
There was a problem connecting to the server
$ tsql -S MYSERVER -U myusername -P mypassword
locale is "en_US.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
There was a problem connecting to the server

Additionally, running tsql -LH gives no output:


I don't believe the issue is with a firewall or anything else on the SQL Server side, because:

  1. I am able to telnet to the server:

    $ telnet my.server.address 1433
    Connected to my.server.address.
  2. And, I can successfully connect to the SQL Server via ODBC from a (Windows) laptop, via the ODBC Data Source Administrator utility.

Contents of my /etc/freetds.conf:

  tds version = 7.0
; tds version = 4.2
  host = my.server.address
  port = 1433
  tds version = 7.0

Contents of TDSDUMP log file after running tsql -S MYSERVER:

log.c:167:Starting log file for FreeTDS 0.95.19
  on 2015-11-18 10:02:20 with debug flags 0x4fff.
iconv.c:328:tds_iconv_open(0x1c53d90, UTF-8)
iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
iconv.c:187:local name for UTF-8 is UTF-8
iconv.c:187:local name for UCS-2LE is UCS-2LE
iconv.c:187:local name for UCS-2BE is UCS-2BE
iconv.c:346:setting up conversions for client charset "UTF-8"
iconv.c:348:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:395:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
iconv.c:400:tds_iconv_open: done
net.c:202:Connecting to port 1433 (TDS version 7.0)
net.c:274:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:313:tds_open_socket() succeeded
util.c:165:Changed query state from DEAD to IDLE
login.c:797:using GSS authentication
gssapi.c:218:using kerberos name MSSQLSvc/my.server.address:1433
gssapi.c:230:gss_import_name: GSS_S_COMPLETE: gss_import_name completed successfully.
gssapi.c:318:gss_init_sec_context: actual mechanism at 0x(nil)
gssapi.c:334:gss_init_sec_context: min_stat 2529639136 "Unknown error -1765328160"
gssapi.c:374:gss_init_sec_context: GSS_S_FAILURE: The routine failed for reasons that are not defined at the GSS level.
login.c:472:login packet rejected
util.c:165:Changed query state from IDLE to DEAD
util.c:322:tdserror(0x1c53ca0, 0x1c53d90, 20002, 0)
util.c:352:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:375:tdserror: returning TDS_INT_CANCEL(2)

just remove special character from password and try again , i got the same problem and solve this way

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.