0

I'm in a linux container using the gem file tiny_tds (verions 2.1.1) to try to connect to sql server on an Azure Managed instance.

The code I'm using to connect is this:

client=TinyTds::Client.new(:username=>'username@full.server.name', :password=> 'password', :host=>'full.server.name.database.windows.net', :port=>3342, :database=>'database',  :azure=>true)

I've tried running this both from the ruby console, as well as from within the container.

Here is the info for the freetds that I'm using:

                        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

I'm consistently getting the error message: Login failed for user 'username@full.server.name

Curiously, I'm able to connect via freetds:

tsql -H full.server.name.database.windows.net -U username -D database -p 3342 -P password

I'm wondering if it has something to do with the server/host having multiple '.' characters in the host name.

Also, from what I've read about tiny_tds, when connecting to Azure, the username needs to have the @servername appended to it.

I have tried several version of tiny_tds (all to no effect).

I have also tried many various permutations of the connection string. Nada.

Please let me know if you have any suggestions!!

Alberto Morillo
  • 13,893
  • 2
  • 24
  • 30
ferris
  • 55
  • 9
  • The connection string suggests that you're using the `username@server.database.windows.net` form instead of the shorter `username@server` form. Also, when compiling FreeTDS (which TinyTDS uses) did you compile it with OpenSSL support? Ref: [Using TinyTDS with Azure](https://github.com/rails-sqlserver/tiny_tds#using-tinytds-with-azure). – AlwaysLearning Apr 22 '21 at 11:25
  • the username that I'm using is the shorter username@server and does not include the database.windows.net. The host does include the database.windows.net string. FreeTDS was already installed in the container, so I'm not sure , but I would think it was compiled with OpenSSL support because in the info that I posted from the tsql -C includes OpenSSL: yes. A follow up question: why does the freetds tsql not require the @servername appended to the username but tiny_tds does require it? – ferris Apr 22 '21 at 12:29
  • Hello @ferris Did you manage to find a solution to this issue? If so, could you please share it with us? – iamdm Jul 27 '21 at 09:37
  • @iamdm - unfortunately, no. We even tried messing around with the Tiny TDS gem but to no effect. But the client was having other issues with the SQL server in Azure managed instance (so may have been something on their end), and they rolled it back, and the task fell off my plate. – ferris Jul 28 '21 at 17:48

0 Answers0