Search code examples
ruby-on-railssql-servertiny-tds

Rails tiny_tds symbol lookup error


Get an error when running a query within a Rails app or console against a SQL Server with tiny_tds. Note: gem install tiny_tds was successful.

Undefined symbol: rb_thread_blocking_region

../bin/ruby: symbol lookup error: 
/var/www/.../tiny_tds-0.6.2/lib/tiny_tds/tiny_tds.so: 
undefined symbol: rb_thread_blocking_region

My system setup:

  • Centos 7.0
  • Ruby 2.2.0p0
  • Rails 4.1.4

freetds and freetds-devel are installed:

    Version: freetds v0.91
         freetds.conf directory: /etc
 MS db-lib source compatibility: yes
    Sybase binary compatibility: yes
                  Thread safety: yes
                  iconv library: yes
                    TDS version: 4.2
                          iODBC: no
                       unixodbc: yes
          SSPI "trusted" logins: no
                       Kerberos: yes

My MSSQL section of config/database.yml looks like (I'm connecting to a remote host):

devel_sql:
  adapter: sqlserver
  mode: dblib
  dataserver: DBSERVER\DBINSTANCE
  encoding: utf8
  database: SOMEDATABASENAME
  username: xxxx
  password: yyyy
  reconnect: true
  autocommit: true
  timeout: 5000

My Gemfile:

source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer',  platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem 'pg'
# MSSQL gems
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'

The query worked on a Centos 6.3. May any version conflicts?


Solution

  • Found the solution. I verified that tiny_tds 0.6.2 runs with ruby 2.1.1. ruby 2.2.0 seems not yet to be supported. Found the discussion here.