I'm trying to connect to a remote SQL Server (version 2014) from Ruby.I can connect via a UI Client, so the host, user, and password are correct.
My code looks like
require 'tiny_tds'client = TinyTds::Client.new(host: '172.xx.0.xxx', database: 'XXXXxxxxxTEST', username: 'sa', password: 'Xnforxxxx')results = client.execute("SELECT * FROM XXX_ProcessOrder")
sig@mbp xxx % tsql -CCompile-time settings (established with the "configure" script) Version: freetds v1.4.10 freetds.conf directory: /usr/local/etc MS db-lib source compatibility: no Sybase binary compatibility: yes Thread safety: yes iconv library: yes TDS version: 7.3 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: yes OpenSSL: yes GnuTLS: no MARS: yes
sig@mbp xxx % gem list tiny*** LOCAL GEMS ***tiny_tds (2.1.7)
Ans this is the error.
2024-02-26 16:48:55 - TinyTds::Error - Unable to connect: Adaptive Server is unavailable or does not exist (172.xx.0.xxx) (TinyTds::Error):| /Users/sig/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/tiny_tds-2.1.7/lib/tiny_tds/client.rb:60:in `connect'| /Users/sig/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/tiny_tds-2.1.7/lib/tiny_tds/client.rb:60:in `initialize'| /Users/sig/Code/xxx/application.rb:10:in `new'| /Users/sig/Code/xxx/application.rb:10:in `block in <top (required)>'
Am I missing something here?
UPDATE - With the same setup, I can access a SQL Server running locally on Docker.