LoginSignup
0
0

More than 5 years have passed since last update.

tiny_tdsでAzure SQL Databaseに接続できない(解決)

Last updated at Posted at 2017-04-27

TL; DR

tsqlコマンドでは接続できるが、Rubyのtiny_tds gemでは接続できない状況。
freetdsをyumでインストールし直し、gemもインストールし直したら接続できるようになった。
自分でビルドしたfreetdsが原因だった模様。

Rubyで出ていたメッセージは:

/home/ao/tds/vendor/ruby/2.3.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53:in `connect': Adaptive Server connection failed (XXXXXXXXXXX.database.windows.net:1433) (TinyTds::Error)
        from /home/ao/tds/vendor/ruby/2.3.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53:in `initialize'
        from 1.rb:10:in `new'
        from 1.rb:10:in `<main>'

環境

CentOS 7.3.1611
Ruby 2.3.1p112
freetds-devel-0.95.81-1.el7.x86_64(正常動作)
freetds-0.95.81-1.el7.x86_64(正常動作)
freetds-1.00.27(動作しなかった)
tiny_tds 1.3.0

動作しなかったfreetdsのインストール方法

https://docs.microsoft.com/ja-jp/azure/sql-database/sql-database-connect-query-ruby
のUbuntu用の説明と同様、freetds-1.00.27.tar.gzをビルドした。

正常動作したfreetdsのインストール方法

# yum install epel-release
# yum install freetds freetds-devel
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0