New to rails. Installed rails on my XP desktop, and setup my first app that will use an existing SQLServer database. I am able to connect to SQLServer using odbc with following code.
require 'rubygems' require 'ActiveRecord'
ActiveRecord::Base.establish_connection( :adapter => 'sqlserver', :mode => 'odbc', :dsn => 'Driver={SQL Server};Server=<server>;Database=<db>', :username => 'uid', :password => 'pwd' )
class src <ActiveRecord::Base set_table_name 'Source' set_primary_key 'IDSource' end
s = s = Source.find(1) puts s.SourceName
I was able to connect and the code behaves as expected. However when I try to use database.yml to specify the same connection information, I am unable to connect using script/dbconsole.
#database.yml development: adapter : sqlserver mode : odbc dsn : Driver={SQL Server};Server=<server>;Database=<db> username : <uid> password : <pwd>
When I start script/dbconsole, the error is D:\work\rails\job>ruby script/dbconsole Unknown command-line client for <db>. Submit a Rails patch to add support!
My assumption is that my database.yml does not describe the connection properly, since I am able to connect directly using establish_connection method. Is there any documentation on how to specify a odbc connection in yml for rails?
Here is the list of installed gems :: D:\work\rails\job>gem list
*** LOCAL GEMS ***
actionmailer (2.3.2, 2.0.0) actionpack (2.3.2, 2.0.0) activerecord (2.3.2, 2.0.0) activerecord-sqlserver-adapter (2.2.18) activeresource (2.3.2) activesupport (2.3.2, 2.0.0) dbd-odbc (0.2.4) dbi (0.4.1) deprecated (2.0.1) fxri (0.3.7, 0.3.6) fxruby (1.6.19, 1.6.12) hpricot (0.8.1, 0.6) log4r (1.0.5) ptools (1.1.6) rails (2.3.2) rake (0.8.7, 0.7.3) sources (0.0.1) test-unit (2.0.2) win32-api (1.4.2, 1.0.4) win32-clipboard (0.5.1, 0.4.3) win32-dir (0.3.4, 0.3.2) win32-eventlog (0.5.0, 0.4.6) win32-file (0.6.1, 0.5.4) win32-file-stat (1.3.3, 1.2.7) win32-process (0.6.0, 0.5.3) win32-sapi (0.1.4) win32-sound (0.4.1) windows-api (0.3.0, 0.2.0) windows-pr (1.0.5, 0.7.2)
Thanks and appreciate any help leading to the resolution.