[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

problems with dbi to sql server

Larz

9/28/2007 8:50:00 PM


I'm trying to figure out how to connect to sql server (2005 i think)


this program here, at first used to show the defaukt stuff, ODBC I
think.

DBI.available_drivers.each do |drv|
puts drv
DBI.data_sources(drv).each do |src|
puts " #{src}"
end
end

then I did the config/setup/install with config as shown below for the
dbi stuff I downloaded:

C:\ruby-sql\ruby-dbi>ruby setup.rb config --
with=dbi,dbd_ado,dbd_odbc,dbd_msql,d
bd_mysql,dbd_oracle
entering config phase...
config done.


now the original script above shows nothing, though I see what look
like drivers in a subdirectory called dbd off of my ruby lib and the
following call gives the error shown below:


dbh =
DBI.connect('dbi:ODBC:'+'%q{DRIVER=SQLServer;SERVER=me.my.com;DATABASE=techie;Uid=me;Pwd=*mypass}')




c:/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect': IM002
(0) [Micr
osoft][ODBC Driver Manager] Data source name not found and no default
driver spe
cified (DBI::DatabaseError)
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:424:in `connect'
from c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:215:in `connect'
from C:/rb-play/tst.rb:19

C:\rb-play>

1 Answer

David Mullet

9/29/2007 2:13:00 AM

0

wbsurfver@yahoo.com wrote:
> I'm trying to figure out how to connect to sql server (2005 i think)
>

I regularly use ADO to connect to SQL Server databases:

http://rubyonwindows.bl.../2007/03/ruby-ado-and-sqls...

David

http://rubyonwindows.bl...
--
Posted via http://www.ruby-....