使用tiny_TDS在rails中连接到SQL-Azure:[BUG]分段错误 [英] Connecting to SQL-Azure in rails using tiny_TDS: [BUG] Segmentation fault
问题描述
我们试图让Rails与Azure上的sqlserver数据库对话,我们使用openssl和libiconv安装freeTDS:
We're trying to get rails to talk to a sqlserver db on Azure, we install freeTDS with openssl and libiconv:
./configure --prefix=/usr/local --with-libiconv-prefix=DIR --with-openssl=DIR
make
make install
然后我们将gem_TDS和activerecord-sqlserver-adapter添加到gemfile:
We then add tiny_TDS and activerecord-sqlserver-adapter to the gemfile:
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'
$ bundle install
配置数据库:
development:
adapter: sqlserver
host: xxxxxxx.database.windows.net
mode: DBLIB
port: 1433
database: xxxxx
username: xxxxxxxx
password: x
azure: true
运行服务器:
$ rails s
到目前为止,一切正常,但是一旦您访问该站点,ruby崩溃.
Everything works great up until this point, but as soon as you visit the site ruby crashes.
steven@jenny:~/irr$ rails server -p 3001
=> Booting WEBrick
=> Rails 3.0.4 application starting in development on http://0.0.0.0:3001
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-07-24 15:37:00] INFO WEBrick 1.3.1
[2012-07-24 15:37:00] INFO ruby 1.9.2 (2012-02-14) [x86_64-linux]
[2012-07-24 15:37:00] INFO WEBrick::HTTPServer#start: pid=7586 port=3001
/home/steven/.rvm/gems/ruby-1.9.2-p318/gems/tiny_tds-0.5.1/lib/tiny_tds/client.rb:68: [BUG] Segmentation fault
ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-linux]
-- control frame ----------
c:0048 p:---- s:0232 b:0232 l:000231 d:000231 CFUNC :connect
c:0047 p:0429 s:0228 b:0228 l:000227 d:000227 METHOD /home/steven/.rvm/gems/ruby-1.9.2-p318/gems/tiny_tds-0.5.1/lib/tiny_tds/client.rb:68
我们尝试了红宝石的几种版本:1.9.2-p318,1.9.2-p320,1.9.3-p125.所有这些都存在相同的错误.
We've tried several versions of ruby: 1.9.2-p318, 1.9.2-p320, 1.9.3-p125. Same error with all of them.
这是在ubuntu 11.10上使用rvm和FreeTDS-0.9.1.
This is on ubuntu 11.10 using rvm and FreeTDS-0.9.1.
有任何解决方法的想法吗?
Any Ideas on a workaround?
我在途中某个地方犯了错误吗?
Have I made an error somewhere along the way?
IRB的输出
require 'tiny_tds'
client = TinyTds::Client.new(:username =>'XXXXX@XXXXXXX.database.windows.net', :password => 'XXXXXXX', :host => 'XXXXXX.database.windows.net', :mode => 'DBLIB', :azure => 'true')
SystemStackError: stack level too deep from /home/martinr/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/irb/workspace.rb:80
Maybe IRB bug!!
这似乎是红宝石本身的错误:
It seems to be a bug with ruby itself:
/home/martinr/.rvm/gems/ruby-1.9.2-p320/gems/tiny_tds-0.5.1/lib/tiny_tds/client.rb:68: [BUG] Segmentation fault (core dumped)
推荐答案
该错误似乎是由用户名username@servername
The error seems to be caused by having a username username@servername
当您删除@severname
部分时,红宝石不再崩溃
When you remove the @severname
part, ruby no longer crashes
这篇关于使用tiny_TDS在rails中连接到SQL-Azure:[BUG]分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!