FreeTDS problem connecting to SQL Server on Mac (Unexpected EOF from the server)
Asked Answered
D

6

8

I have setup FreeTDS to connect to SQL Server database. When I try to open TSQL in terminal on Mac (lion) I get this error:

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
    OS error 36, "Operation now in progress"
Error 20002 (severity 9):
    Adaptive Server connection failed
There was a problem connecting to the server

Does anybody have a clue what could be causing this?

Deceleron answered 7/8, 2011 at 14:28 Comment(1)
having the exact same issue here, attempting to connect to a SQL Server 2008 R2 server, hosted on a Win 2008 SP2 64 bit server, from lion with tsqlProcessional
S
9

To make this permenant I found I need to edit the freetds.conf file and set it globally in there

vim /usr/local/freetds/etc/freetds.conf

tds version = 8.0

running tsql -C still showed that the version was 5.0 but connecting now worked every time.

Showplace answered 2/3, 2012 at 11:38 Comment(3)
Yep, the version 5.0 in the tsql -C definitely threw me off, but changing the tds version to 8.0 fixed this error.Roadhouse
In my case the file was in /etc/freetds/freetds.conf.Simp
Connection works with 7.3 with all versions including Azure. You're not supposed to use 8.0 anymore: freetds.org/userguide/choosingtdsprotocol.htmStat
P
12

I think I got it, it's the TDS configured version, I had 5.0, which caused the error

Try running tsql -C to check what version are you using, and then you can invoke tsql overriding the version with:

TDSVER=7.0 tsql -H hostname -p port -U domain\\\username -P password

and it worked!

Processional answered 13/8, 2011 at 17:4 Comment(0)
S
9

To make this permenant I found I need to edit the freetds.conf file and set it globally in there

vim /usr/local/freetds/etc/freetds.conf

tds version = 8.0

running tsql -C still showed that the version was 5.0 but connecting now worked every time.

Showplace answered 2/3, 2012 at 11:38 Comment(3)
Yep, the version 5.0 in the tsql -C definitely threw me off, but changing the tds version to 8.0 fixed this error.Roadhouse
In my case the file was in /etc/freetds/freetds.conf.Simp
Connection works with 7.3 with all versions including Azure. You're not supposed to use 8.0 anymore: freetds.org/userguide/choosingtdsprotocol.htmStat
E
8

TDS version need to match the correct tds protocol to connect to your db server, see below -

http://www.freetds.org/userguide/choosingtdsprotocol.htm

Choosing a TDS protocol version

***DB SERVER        |    TDS VERSION ***    
Microsoft SQL Server 6.x    = 4.2       
Sybase System 10 and above  = 5.0       
Sybase System SQL Anywhere  = 5.0     
Microsoft SQL Server 7.0    = 7.0       
Microsoft SQL Server 2000   = 7.1       
Microsoft SQL Server 2005   = 7.2   
Microsoft SQL Server 2008   = 7.2 
Eliezer answered 16/8, 2012 at 23:3 Comment(0)
F
2

Also missing symlink on libtdsodbc.so in /usr/lib/odbc (for me)

sudo ln /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so libtdsodbc.so 

should help

Foreglimpse answered 6/11, 2012 at 9:12 Comment(0)
M
1

I was having the same problem. In my situation, the username for the Microsoft SQL Server database was in the form, DOMAIN\userid. However, when I typed it on the command line, I think it was interpreting the slash as an escape character. When I tried putting the slash the other direction, it still failed. Finally, I tried putting two slashes in the original direction and it worked. Thus the following worked for me:

tsql -S myhost -U DOMAIN\\userid
Motheaten answered 7/7, 2017 at 17:2 Comment(0)
A
0

I encountered the same error. Then I did the following, and the error went away:

  1. pip install pyodbc
  2. Previously, I had used quotes for the DB server, username, and pwd in the TSQL command. This time, I removed the quotes.
Aubrey answered 19/4, 2019 at 16:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.