【问题标题】:ruby sybase connection through dbi, issues with native sybase driver class name to be used in connection string通过 dbi 进行 ruby​​ sybase 连接,连接字符串中使用的本机 sybase 驱动程序类名存在问题
【发布时间】:2015-04-29 18:30:38
【问题描述】:

有人在 Ruby 中使用dbi 成功连接到sybase db

我似乎无法为此构造连接字符串。

dbh = DBI.connect('dbi:<xyz>:<db-name>','<user-name>', '<pwd>' )

以下是我得到的错误格式-

 C:/Ruby187/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:300:in `load_driver': Unable to load driver '<xyz>' (underlying error: uninitialized constant DBI::DBD::<db-name>) (DBI::InterfaceError)
from C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from C:/Ruby187/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
from C:/Ruby187/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
from C:/Ruby187/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
from C:/Simple/algo/db.rb:13

当我通过另一个 Rails 应用程序连接但似乎无法找到它的名称时,我使用本机 sybase drivers to 连接到 sybase db。 (请让我知道是否有办法使用command/global variable 或其他东西在工作的rails 应用程序中找到数据库驱动程序名称)。

提前感谢您的帮助!

【问题讨论】:

    标签: ruby sybase dbi


    【解决方案1】:

    使用 SybSQL 而不是 DBI 做到了。

    query=SybSQL.new({'S'=>@@server,'U'=>@@user,'P'=>@@passwd})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 2012-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多