gpt4 book ai didi

ruby - 使用 tiny_TDS : [BUG] Segmentation fault 在 rails 中连接到 SQL-Azure

转载 作者:太空宇宙 更新时间:2023-11-03 18:25:36 24 4
gpt4 key购买 nike

我们试图让 rails 与 Azure 上的 sqlserver 数据库对话,我们使用 openssl 和 libiconv 安装 freeTDS:

./configure --prefix=/usr/local --with-libiconv-prefix=DIR --with-openssl=DIR
make
make install

然后我们将 tiny_TDS 和 activerecord-sqlserver-adapter 添加到 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 就会崩溃。

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

我们已经尝试了几个版本的 ruby​​:1.9.2-p318、1.9.2-p320、1.9.3-p125。所有这些都出现同样的错误。

这是在 ubuntu 11.10 上使用 rvm 和 FreeTDS-0.9.1。

关于解决方法的任何想法?

我是不是在某个地方犯了错误?

编辑

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!!

看来是ruby本身的bug:

/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)

最佳答案

你应该只做一个简单的 IRB 提示,然后做像 TinyTDS read me 中提到的这样的事情。


需要'tiny_tds'
客户端 = TinyTds::Client.new(...)

填写您的连接参数。简单的东西,如用户名、密码和主机。让我知道事情进展如何。

关于ruby - 使用 tiny_TDS : [BUG] Segmentation fault 在 rails 中连接到 SQL-Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11632743/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com