Skip to content

Instantly share code, notes, and snippets.

@metaskills metaskills/connect.rb
Last active Feb 22, 2017

Embed
What would you like to do?
require 'tiny_tds'
puts 'Connecting to SQL Server'
@client = TinyTds::Client.new(
host: 'localhost', port: 1433,
username: 'sa', password: ENV['SA_PASSWORD'],
)
def execute(sql)
@client.execute(sql).do
true
end
puts 'Creating Database'
execute "CREATE DATABASE SampleDB"
@client.close
puts 'Done'
# Output
Connecting to SQL Server
Creating Database
Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.