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.

···

--
Posted via http://www.ruby-forum.com/.

Parul Korea 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

···

--
Posted via http://www.ruby-forum.com/\.

if your are working with rails you can try

<http://github.com/rails-sqlserver/activerecord-sqlserver-adapter&gt;

···

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

On Fri, Aug 6, 2010 at 3:49 AM, Parul Korea <parulg@covelix.com> 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.
--
Posted via http://www.ruby-forum.com/\.