在Rails应用程序或控制台中针对具有tiny_tds的SQL Server运行查询时出错。
注意:gem install tiny_tds
成功。
未定义的符号: 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
我的系统设置:
安装了freetds和freetds-devel:
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
我的config/database.yml
的MSSQL部分看起来像(我正在连接到远程主机):
devel_sql:
adapter: sqlserver
mode: dblib
dataserver: DBSERVER\DBINSTANCE
encoding: utf8
database: SOMEDATABASENAME
username: xxxx
password: yyyy
reconnect: true
autocommit: true
timeout: 5000
我的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'
该查询适用于Centos 6.3。可能有任何版本冲突吗?
答案 0 :(得分:1)
我使用的是tiny_tds 0.6.2,ruby 2.2.2,capistrino 3.2.1和unicorn 4.9.0。
tiny_tds 0.6.2与它们不兼容。所以我改变了
gem 'tiny_tds', '~> 0.6.3.rc1'
并升级了tiny_tds并且工作正常。希望它对你和其他人也有用。
答案 1 :(得分:0)
找到解决方案。我验证了tiny_tds 0.6.2与ruby 2.1.1一起运行。 ruby 2.2.0似乎还没有得到支持。 找到了讨论here。