From: Fernando Allen Marques de Oliveira Date: 2006-05-02T21:24:08+09:00 Subject: Re: ODBC Database Connectivity Alan wrote: > Hi, > > I am having such hard time to connect to a ODBC data source. (Windows > XP) > > I have C# and ADO.NET background and I am shocked when I see there is so > little database connectivity support for Ruby! > > Am I missing something or Ruby is not good for connecting to databases? > > Thanks, > Alan Hello Alan, I'm using Ruby DBI module with the ODBC package in windows. The best way to have it all is to get the ruby one-click installer (http://rubyforge.org/projects/rubyinstaller/) Then, all you have to do is (for example): require 'DBI' # make an ODBC connection conn = DBI.connect('DBI:ODBC:datasource','your_username','your_password') # returns a list of the table names from your database conn.tables # returns an array with the resultset from your query rs = conn.select_all('SELECT * FROM TABLE') You can google around to find more information about ruby's DBI module, but here goes some links that can help you: http://www.kitebird.com/articles/ruby-dbi.html http://ruby-dbi.rubyforge.org/ http://www.connectionstrings.com/ -- Posted via http://www.ruby-forum.com/.