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?


Found the answer here: http://jonkinney.com/articles/2009/11/23/change-locale-on-os-x-snow-leopard-for-freetds-functionality

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.

| improve this answer | |

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.