Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I built freetds 0.82 from macports using the +mssql variant (which sets up dblib and sets the default tds version to 8.0). I am now trying to connect to my database server (MSSQL Server 2005) using tsql, but it only works when I override the tds version to 4.2. If I set it to any other value, I get the follow error output.

> TDSVER=8.0 tsql -h <host> -p <port> -U <user> -P<password>
locale is "en_US.utf-8"
locale charset is "utf-8"
Msg 20017, Level 9, State -1, Server OpenClient, Line -1
Unexpected EOF from the server
Msg 20002, Level 9, State -1, Server OpenClient, Line -1
Adaptive Server connection failed
There was a problem connecting to the server

If i use TDSVER=4.2, it works just fine. Anyone know how to solve this?

share|improve this question
up vote 0 down vote accepted

Found the answer here:

The problem was that my locale encoding needed to be set to UTF-8

export LC_ALL=en_US.UTF-8

After that, I was able to connect with version 8.0 of the TDS protocol.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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