mamekun
9/20/2013 - 7:01 AM

ruby gem sequelを利用しSQL Serverへの接続例 http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html

ruby gem sequelを利用しSQL Serverへの接続例 http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html

require 'sequel'

hostname = 'host'
dbname = 'dbname'
username = 'username'
password = 'password'

# connect(ado)
db = Sequel.connect( 'ado://#{username}:#{password}@#{hostname}/#{dbname}' )

# select all
db['select * from T_testtable'].each{|row| p row}