Martinffx
Martinffx

Reputation: 2476

Connecting to SQL-Azure with freeTDS error: Read from the server failed

I'm trying to a SQl-Azure database from ubuntu 12.04.

I've downloaded freeTDS-0.91 and compiled it with openssl and libiconf (for use with the tiny_tds gem).

When I try connect to the sql-azure db I get the following error:

martinr@martinr-DT:~/code/psg-web$ tsql -U Username -P Password -H servername.database.windows.net -p 1433
locale is "en_ZA.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20004 (severity 9):
    Read from the server failed
OS error 104, "Connection reset by peer"
Error 20002 (severity 9):
    Adaptive Server connection failed
There was a problem connecting to the server

I can't seem to find anything on what is causing this error, and how to resolve it.

I can connect to instances of ms-sqlserver on a windows-server machine in the office without any problems.

Any help will be much appreciated.

Upvotes: 6

Views: 2286

Answers (2)

Piotr Uchman
Piotr Uchman

Reputation: 570

For azure sql use protocol version 8.0 (or 7.x). You can force it by:

TDSVER=8.0 tsql -U Username@servername -P Password -H servername.database.windows.net -p 1433

Upvotes: 3

trbrink
trbrink

Reputation: 137

I got it to work using this post. Be sure to follow the instructions up till the part titled Going The Extra Mile With Ruby 1.9.x unless you've been using ruby 1.8 and are now goin to use 1.9. In a later post the author said to leave off the +utf8 when running sudo port install rb-odbc +utf8 as he instructed in his first post.

You can test the connection using isql like so:

isql server Username Password

For server enter the name you put in brackets in the odbc.ini file.

Upvotes: 0

Related Questions