Connecting to SQL Server 2005

P

Parul Korea

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.
 
D

Damjan Rems

Parul said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top