rails-sqlserver / tiny_tds

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

Error connecting to SQL*Server via tiny_tds with TLS 1.0 disabled #443

Open ehansen486 opened 4 years ago

ehansen486 commented 4 years ago

Environment

Operating System

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty
Linux ... 3.13.0-88-generic #135-Ubuntu SMP Wed Jun 8 21:10:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

TinyTDS Version and Information

tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.00.21
             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: yes
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: yes
                             GnuTLS: no
                               MARS: no

here are the gems I have installed:

bigdecimal (1.2.6)
bundler (1.16.2)
hiredis (0.6.1)
io-console (0.4.3)
json (1.8.1)
minitest (5.4.3)
mysql2 (0.5.1)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
redis (3.3.5)
redis-queue (0.0.4)
stomp (1.4.4)
test-unit (3.0.8)
tiny_tds (2.1.1)

My SQL-Server provider just disabled TLS 1.0 and enabled TLS 1.1/1.2. After that change, I am unable to connect to SQL*Server from TinyTDS. I AM able to connect with tsql, no problem. I'm using the same credentials. This system has been running successfully since 2018 and we have made no recent changes.

The error I get is:

TinyTds::Error: Adaptive Server connection failed (....)
    from /usr/local/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/tiny_tds-2.1.1/lib/tiny_tds/client.rb:60:in `connect'
    from /usr/local/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/tiny_tds-2.1.1/lib/tiny_tds/client.rb:60:in `initialize'
    from /home/ubuntu/db_sync/src/db_sqlserver.rb:12:in `new'
    from /home/ubuntu/db_sync/src/db_sqlserver.rb:12:in `rescue in initialize'
    from /home/ubuntu/db_sync/src/db_sqlserver.rb:7:in `initialize'
    from /home/ubuntu/db_sync/src/db.rb:41:in `new'
    from /home/ubuntu/db_sync/src/db.rb:41:in `provision'
    from (irb#1):4

The db_error_number I see in the TinyTds::Error object is 20002.

Any help or suggestions would be much appreciated.

Thanks, Eric

LagTag commented 4 years ago

@ehansen486 did you ever work out a solution? Our DB Admin wants to upgrade to 1.2, but we are having the same issue.

ehansen486 commented 4 years ago

No unfortunately not. I can connect with Free TDS, but alas TinyTds is not working.

CoryRolstad commented 3 years ago

Same thing happened to me, due to security constraints MSSQL server was set to TLS 1.2. I was able to get Tiny_TDS working with setting the client tds_version to 7.4. Anything below that did not work.