rails-sqlserver / tiny_tds

TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
Other
605 stars 191 forks source link

Issue Connecting to Azure SQLServer Public Endpoints #499

Open jacobreeves opened 3 years ago

jacobreeves commented 3 years ago

Operating System

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

TinyTDS Version and Information

TinyTds 2.1.1

FreeTDS Version

tsql -C

Compile-time settings (established with the "configure" script)
                            Version: freetds v1.00.91
             freetds.conf directory: /usr/local/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 7.3
                              iODBC: no
                           unixodbc: no
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: yes
                             GnuTLS: no
                               MARS: no

Description

We are attempting to get TinyTds to connect to an Azure instance via the public endpoint. For public endpoints the host matches the pattern: azure-host.public.some-guid.database.windows.net and the port is 3342.

Using the tsql command below, this works just fine and it connects immediately tsql -H azure-host.public.some-guid.database.windows.net -U username -p 3342 -P password

However, if we attempt to connect using TinyTds from the same host using the command below client=TinyTds::Client.new( :username=> 'username@azure-host', :password=> 'password', :host=>'azure-host.public.some-guid.database.windows.net', :port=>3342, :encoding=>"UTF-8", :azure=>true )

we get the auth error below (pulled from freetds.log) 19:39:55.052288 2790 (token.c:2384):tds_process_info() reading message 18456 from server

So the questions are:

Thanks!

jacobreeves commented 3 years ago

Hi

Just checking to see if anyone has any ideas on this.

Thanks!

bvogelzang commented 3 years ago

Complete guess but have you tried setting the username as username@azure-host.public.some-guid?

jacobreeves commented 3 years ago

Thanks @bvogelzang. Yes. I've tried every permutation I can think of. I've replicated the problem at the FreeTDS level and am going to post a similar issue there.

aditandrau commented 3 years ago

Hello,

Do you have any updates on this issue?

We are encountering the same issue.

Thanks!

jacobreeves commented 3 years ago

Hi @aditandrau. Unfortunately, the only update we have is an issue opened against the underlying FreeTDS library here.