TinyTds::Error: Adaptive Server connection failed

房东的猫 提交于 2019-12-23 13:16:10

问题


This is an odd one. I have some ruby code on my machine which uses the tiny_tds version: 0.6.0.rc1

and everything works fine. When a co-worker attempt to run the same code he gets the following error:

TinyTds::Error: Adaptive Server connection failed

We are connecting without providing username or password as it's not needed on my machine. Any ideas? could this be a rights thing on the sql database?

Thanks in advance

It should be noted on the machine with issues we have SQL 2008 R2 and SQL Express installed. We can connect to SQL express but not SQL 2008 R2

Here's the code we are using

def self.GetTestMprsFromDB(dataServer,database,query)

mprids = Array.new

client = TinyTds::Client.new(:dataserver => dataServer, :database => database, :timeout => 1000)

When stepping into tiny_tds on initialize

def initialize(opts={})
  if opts[:password] && opts[:password].to_s.strip != ''
    opts[:password] = opts[:password].to_s
    warn 'FreeTDS may have issues with passwords longer than 30 characters!' if opts[:password].length > 30
  end
  raise ArgumentError, 'missing :host option if no :dataserver given' if opts[:dataserver].to_s.empty? && opts[:host].to_s.empty?
  @query_options = @@default_query_options.dup
  opts[:appname] ||= 'TinyTds'
  opts[:tds_version] = TDS_VERSIONS_SETTERS[opts[:tds_version].to_s] || TDS_VERSIONS_SETTERS['71']
  opts[:login_timeout] ||= 60
  opts[:timeout] ||= 5
  opts[:encoding] = (opts[:encoding].nil? || opts[:encoding].downcase == 'utf8') ? 'UTF-8' : opts[:encoding].upcase
  opts[:port] ||= 1433
  opts[:dataserver] = "#{opts[:host]}:#{opts[:port]}" if opts[:dataserver].to_s.empty?
  connect(opts)
end

At end it throws the error

来源:https://stackoverflow.com/questions/15369304/tinytdserror-adaptive-server-connection-failed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!