I'm trying to use the sql server adapter on a windows XP machine from
a plain ruby script and am getting the subject error. Here's my
script:
# ===================
require 'dbi'
require 'activerecord'
require 'activerecord-sqlserver-adapter'
db_config = { :adapter => 'sqlserver',
:mode => 'ODBC',
:server => 'ctrhs-sql2k\sql2k',
:database => 'eHealth',
:dsn => 'Driver={SQL Server Native Client 10.0};Server=ctrhs-
sql2k\sql2k;Database=eHealth;Trusted_Connection=Yes'
}
::ActiveRecord::Base.establish_connection(db_config)
c = ::ActiveRecord::Base.connection
puts(c.inspect)
puts(c.methods.sort.join("\n"))
# ===================
Probably that :dsn isn't completely kosher, but I'm not even getting
that far. On the require 'dbd-odbc' line I get
parse_docs.rb:5:in `require': no such file to load -- dbd-odbc
(LoadError) from
parse_docs.rb:5:in `<main>'
If I comment-out that require I get:
c:/ruby19/lib/ruby/gems/1.9.1/gems/dbi-0.4.3/lib/dbi.rb:300:in
`block in
load_driver': Unable to load driver 'ODBC' (underlying error:
uninitialized
constant DBI::DBD::ODBC) (DBI::InterfaceError)
on the line:
c = ::ActiveRecord::Base.connection
My googling on the first error mostly turns up references to ruby-odbc
(http://www.ch-werner.de/rubyodbc/) but my attempts to install that
have failed--it seems to be a unix thing?
I do indeed have dbd-odbc installed--gem list --local gives me (in
part):
activerecord (2.3.4, 2.3.3)
activerecord-sqlserver-adapter (2.2.22)
dbd-odbc (0.2.4)
dbi (0.4.3, 0.4.1)
What can I do to get this working?
Many thanks!
-Roy
- Ken
> --
> You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
> To post to this group, send email to rails-sqlse...@googlegroups.com.
> To unsubscribe from this group, send email to rails-sqlserver-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-sqlserver-adapter?hl=en.
>
>