From: "lrlebron@..." Date: 2008-05-08T08:15:07+09:00 Subject: Re: Code for connecting to SQL Server? On May 7, 6:18 am, Anukul Singhal wrote: > Hi, > > I want to connect to my SQL Server DB through ruby code. > > Searched on the connection and was provided some steps like: > > 1. Save the latest source distribution of ruby-dbi and copy the file > ADO.rb to > X:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb > > 2. Then, in your database.yml, > > development: >    adapter: sqlserver >    database: database_name >    host: server_name >    username: user_name >    password: pwd > > I am not able to find this file. > > Can anyone tell me for invoking sql server in SCITE editor? > > Is there any other procedure 'coz I dont have rails installed? > > Thanks, > Anukul > -- > Posted viahttp://www.ruby-forum.com/. require 'dbi' @server_name='localhost' @dbh=DBI.connect("DBI:ADO:Provider=SQLNCLI;Data Source=#{@server_name};Integrated Security=SSPI") if @dbh puts "connected" else puts "not connected" end @dbh.select_all('SELECT name FROM master.sys.databases ORDER BY 1') do | row| puts row end Here's an example. Luis