Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 237
Martinffx Avatar asked Jul 31 '12 14:07

Martinffx


People also ask

Can't connect to SQL Server on Azure?

Steps to resolve persistent connectivity issuesSet up firewall rules to allow the client IP address. On all firewalls between the client and the Internet, make sure that port 1433 is open for outbound connections. Review Configure the Windows Firewall to Allow SQL Server Access for additional pointers.

Can't connect to Azure SQL managed instance?

If you are unable to connect to SQL Managed Instance from an Azure virtual machine within the same virtual network but a different subnet, check if you have a Network Security Group set on VM subnet that might be blocking access.


1 Answers

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
like image 51
Piotr Uchman Avatar answered Sep 24 '22 10:09

Piotr Uchman