Found the solution.
My install of tiny-tds was version 0.51.
The latest version has SSPI, and so to get that:
gem install tiny_tds --version ">= 0.6.0.rc1"
This comes with no need to specify a username/password and use SSPI by default.
So as an example:
require 'tiny_tds'
sql = "SELECT name from sys.databases"
client = TinyTds::Client.new(:dataserver => "myserver", :database => "mydatabase")
result = client.execute(sql)
results = result.each(:symbolize_keys => true, :as => :array, :cache_rows => true, :empty_sets => true) do |rowset| end
#THIS IS TO OUTPUT IT TO THE CONSOLE
for i in (0..result.fields.length)
printf("%14s", result.fields[i])
end
for j in (0...result.affected_rows)
puts ""
for i in (0...result.fields.length)
printf("%14s",results[j].at(i))
end
end
Will print out a list of the database names, using SSPI to access the database.