Hi.

I am connecting from Console to SQL Server with ruby on rails on windows XP
but while executing the following code, only the coloured code is executing,
i want the exact procedure, how to connect from database step by step
procedure..

require "dbi"

begin
  # connect to the SQL server
  dbh = DBI.connect("DBI:ODBC:TESTDB:localhost",
"testuser", "test123")
# get server version string and display it
row = dbh.select_one("SELECT VERSION()")
puts "Server version: " + row[0]
rescue DBI::DatabaseError => e
puts "An error occurred"
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
ensure
# disconnect from server
dbh.disconnect if dbh
end

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to