【问题标题】:Ruby on Rails - Tiny TDS with Windows 7Ruby on Rails - 带有 Windows 7 的微型 TDS
【发布时间】:2013-12-30 00:44:06
【问题描述】:

我在 Windows 7 64 位中使用 Tiny TDS。

配置:

Ruby: 1.9.3
Rails: 4.0.0
Tiny TDS: 0.6.1

数据库.yml

development:
adapter: sqlserver
host:     localhost
dataserver: PAVEI-PC\PAVEI
database: TKD_SUBD
username: pavei
password: pavei

在 Rails 控制台中

client = TinyTds::Client.new(:username => 'pavei', :password => 'pavei', :dataserver => 'PAVEI-PC\PAVEI', :database => 'TKD_SUBD')
irb(main):003:0* client.execute("teste")
TinyTds::Error: closed connection
    from (irb):3:in `execute'
    from (irb):3

我不知道为什么连接被关闭了!

【问题讨论】:

  • 查看日志。检查防火墙。
  • windows 防火墙已关闭,日志上没有打印任何内容
  • 您可以使用 GUI 或其他类型的客户端连接到此服务器吗?
  • 是的,看这张图片oi44.tinypic.com/2qv72p0.jpg

标签: ruby-on-rails freetds tiny-tds


【解决方案1】:

您的配置文件不正确。正如TinyTds Readme 中提到的,只有当:dataserver 为空并且两者都有时,才必须使用:host。但是控制台中的执行命令是正确的。

我有同样的问题,在客户端创建后连接就关闭了,只有当我使用:dataserver而不是:host时才会发生这种情况

作品:

 client = TinyTds::Client.new username: 'sa', password: 'secret', host: '192.168.0.74', database: 'MyDB'

不起作用(连接已关闭):

 client = TinyTds::Client.new username: 'sa', password: 'secret', dataserver: 'MYNTBK\SQLEXPRESS', database: 'MyDB'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-21
    • 1970-01-01
    • 2011-09-22
    • 2011-05-30
    • 1970-01-01
    • 2019-08-31
    • 1970-01-01
    • 2010-12-06
    相关资源
    最近更新 更多