I got a note the other day that the 0.6.3-rc2 version of TinyTDS now includes the security bits needed to communicate with Azure SQL Database, on the Windows platform (it worked on other platforms just fine.) Previously, you had to manually build it against OpenSSL for it to work on Windows platforms, but with the new version it 'just works'. Use the following to install it from the command line:
gem inst tiny_tds --pre
or in a Gemfile use:
gem "tiny_tds", "0.6.3-rc2"
The following code is an example of connecting to SQL Database using the tiny_tds gem:
require 'tiny_tds' client=TinyTds::Client.new(:username=>’user’, :password=> ‘password’,
:dataserver=>’servername.database.windows.net', :port=>1433, :database=>’databasename’,
results=client.execute("select * from [names]")
results.each do |row|
puts row end
Tiny_tds can also be used with ActiveRecord. The following is an example database.yml for using a dblib connection to SQL Database using the tiny_tds gem.
CREATE CLUSTERED INDEX [idx_schema_migrations_version] ON [schema_migrations] ([version])