Connecting to MS SQL (Azure) using FreeTDS

I am on Mac OS X Mavericks and am trying to use pyodbc to connect to a Microsoft Azure MS SQL server. I want to use a DSN-less connection for simplicity and install FreeTDS and pyodbc (which is what I end up using) using MacPorts.

1. tsql configuration

$ tsql -C

Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91.103
             freetds.conf directory: /opt/local/etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 5.0
                              iODBC: no
                           unixodbc: no
              SSPI "trusted" logins: no
                           Kerberos: no

      

2. odbc.ini (/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/databases/MyODBC/files/odbc.ini)

[MSSQL]
Description = MyDatabase
Driver = FreeTDS
Servername = xxxxxxx.database.windows.net
UID = username
PWD = password
Port = 1433
TDS_Version = 7.0

      

3.isql test

$ isql -v MSSQL

[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect

      

4.tsql test

$ tsql -H xxxxxxxx.database.windows.net -p 1433 -U xxxxxx -P xxxxxx

locale is "en_AU.UTF-8" 
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server

      

I tried using TDSVER=8.0

and TDSVER=7.1

before the command, as done in this post . Using TDSVER=7.1

I get a slightly different error ...

Error 20017 (severity 9):
    Unexpected EOF from the server
Error 20002 (severity 9):
    Adaptive Server connection failed
There was a problem connecting to the server

      

Can anyone help me diagnose and get through this?

Thank!

+3


source to share


1 answer


Check this link. He solved my problems similar to yours.



http://martinrichards.tumblr.com/post/28488121620/connecting-to-sql-azure-using-freetds

+3


source







All Articles