TinyTds::Error: Adaptive Server connection failed

2019-06-25 14:04发布

问题:

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

标签: ruby tiny-tds