3
votes

I'm on Mac OS X Mavericks, and trying to use pyodbc to connect to a Microsoft Azure MS SQL server. I'm wanting to use a DSN-less connection for simplicity and have installed FreeTDS and pyodbc (as that's what I want to eventually use) using MacPorts.

1. tsql config

$ 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 it using TDSVER=8.0 and TDSVER=7.1 in front of 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 step through this?

Thanks!

1

1 Answers

4
votes

Check this link. It solved my problems which were similar to yours.

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