6

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.

Martinffx
  • 2,426
  • 4
  • 33
  • 60
  • Did you ever resolve this? I'm having the exact same problem now – dreza Mar 31 '14 at 08:51
  • We did but I can't remember our exact solution. From what I can remember make sure you can telnet to the server and follow the debug instructions in the documentation very carefully. http://www.freetds.org/userguide/serverthere.htm sorry I can't be of more help – Martinffx Mar 31 '14 at 10:40

2 Answers2

3

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
Piotr Uchman
  • 540
  • 3
  • 14
  • I found that Azure SQL (in V12 mode) works with freetds 0.91 when TDSVER is set to 8.0 or 7.1, *not* 7.2. – Habbie Nov 19 '15 at 20:43
0

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.

trbrink
  • 137
  • 1
  • 2
  • 9
  • 1
    Thanks for the answer, my issue is not with connecting to mssqlserver but with sql-azure. I can connect perfectly to an evaluation copy of sqlserver running on a windows server machine I've setup. My problem is connecting to sql-azure. – Martinffx Aug 01 '12 at 13:07