Connecting to SQL Server 2005

I need to connect to SQL server 2005 using Ruby. I went through some
posts but did not found much help.
It would be great if anyone can help me with this.

Parul K. wrote:

I need to connect to SQL server 2005 using Ruby. I went through some
posts but did not found much help.
It would be great if anyone can help me with this.

ODBC is the way.

Linux: Search for “odbc freetds ruby mssql” in google.

Windows: I use DBI with ODBC support. Should not be trouble searching on
google. Here is something to start from.

require ‘dbi’
dbh = DBI.connect(‘DBI:ODBC:Driver={SQL Server};
Server=MYSQL2005;Database=mydb;Uid=myusr;Pwd=mypwd’)

dbh.select_all(“select * from some_table”) do |r|
somefield = r[2].downcase
end
dbh.disconnect

by
TheR

if your are working with rails you can try

http://github.com/rails-sqlserver/activerecord-sqlserver-adapter

Allan D.
http://codesnakes.blogspot.com (my blog)
http://www.linkedin.com/in/javaalley