加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Sequel :: AdapterNotFound:LoadError:无法

发布时间:2020-12-17 04:01:27 所属栏目:百科 来源:网络整理
导读:我成功地使用’续集’连接到 MySQL和Postgres数据库. 我想从Ubuntu 12.04连接到SQL Server数据库到Windows机器.使用tiny-tds我们可以做到这一点,但我想用’续集’进行连接 宝石安装 gem 'dbi'gem 'tiny_tds'gem 'sequel'gem "win32ole-pp"gem "rubysl-win32o
我成功地使用’续集’连接到 MySQL和Postgres数据库.

我想从Ubuntu 12.04连接到SQL Server数据库到Windows机器.使用tiny-tds我们可以做到这一点,但我想用’续集’进行连接

宝石安装

gem 'dbi'
gem 'tiny_tds'
gem 'sequel'
gem "win32ole-pp"
gem "rubysl-win32ole"
gem 'activerecord-sqlserver-adapter'

我收到了以下错误.

1.9.3p448 :007 >   require 'win32ole-pp'
LoadError: cannot load such file -- win32ole-pp

1.9.3p448 :008 > require 'rubysl-win32ole'
 => false 

1.9.3p448 :001 > DB = Sequel.ado(:database => 'test_database',:host => 'xxx.xxx.xxx.xxx',:user => 'username',:password => 'password',:provider => 'SQLNCLI10')
    Sequel::AdapterNotFound: LoadError: cannot load such file -- win32ole

Sequel为微小的tds提供适配器.我该如何使用该适配器?请告诉我如何用续集宝石做到这一点?

我没有得到如何使用续集的小tds,因为续集为tiny_tds提供适配器.

谢谢…

解决方法

最后我可以在续集的帮助下从ubuntu 12.04机器连接到远程MSSQL数据库. Sequel使用tiny_tds连接到SQL Server数据库.这里xxx.xxx.xxx.xxx是远程机器的ip地址.不需要win32ole

Sequel为MySQL2,Postgres,SQL Server和Tiny tds提供适配器.

宝石必备

gem 'tiny_tds' #For SQlServer
gem 'mysql2' #For MySQL
gem 'sequel'

如果您正在连接到MySQL2

DB = Sequel.connect(:adapter => 'mysql2',:password => "passw0rd",:host => "xxx.xxx.xxx.xxx",:database => "test_database")

如果要连接到SQL Server

DB = Sequel.connect(:adapter => 'tinytds',:database => "test_database")

post = DB.from(:test_table)

post.all

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读