'sa', :password => '-6ren">
gpt4 book ai didi

ruby - Tiny_tds : Connect: Server name not found in the configuration files

转载 作者:数据小太阳 更新时间:2023-10-29 07:43:22 26 4
gpt4 key购买 nike

require "rubygems"
require "tiny_tds"

client = TinyTds::Client.new(:username => 'sa', :password => '', :host => 'RICHARD_PC\SQLEXPRESS')
result = client.execute("SELECT * FROM [Contacts]")

result.each do |row|
//Do something
end

我一直收到同样的错误:“连接:在配置文件中找不到服务器名称”。我需要做的就是至少能够连接到 Sql Server。那么如果主机不是我机器上安装的sqlexpress实例,那它是什么呢?在 Github 网站上,它说这个 host => 'mydb.host.net' (:host - 如果 :dataserver 为空则使用。可以是主机名或 IP。)

感谢您的帮助。

最佳答案

要么使用 :dataserver => 'RICHARD_PC\SQLEXPRESS'或者使用 :host => 'RICHARD_PC', :port => 1433

关于ruby - Tiny_tds : Connect: Server name not found in the configuration files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12869544/

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