开发者

SQL server with Rails

开发者 https://www.devze.com 2023-02-01 00:04 出处:网络
I\'ve been trying to get my rails program to access an existing sql express server s开发者_运维百科et up on another machine at work. I\'ve followed these instructions: GitHub and set up my database.y

I've been trying to get my rails program to access an existing sql express server s开发者_运维百科et up on another machine at work. I've followed these instructions: GitHub and set up my database.yml like this:

development:  
adapter: sqlserver  
mode: odbc  
dns: Provider=SQLOLEDB;Data Source=MACHINENAME\SQLEXPRESS;UID=xxxx;PWD=xxxxx;Application Name=atlas  
timeout: 5000

Now when I try to run script/console (or server or whatever) I get this error:

/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant':NameError: uninitialized constant ActiveRecord::WrappedDatabaseException  

I've tried googling and changing settings back and forth but i've come up blank. Am I doing something awfully wrong or what?

BR,

SG


I can only speak for using Rails 3.0.3 with SQLServer 2005, so I hope that helps you a bit.

I've added this to my Gemfile:

gem 'ruby-odbc', '0.99991', :require => 'odbc'
gem 'activerecord-sqlserver-adapter', :branch => "arel2",
  :git => "git://github.com/rails-sqlserver/activerecord-sqlserver-adapter"

And use this in my config/database.yml:

test:
  adapter: sqlserver
  mode: ODBC
  dsn: my_app_test
  username: [USERNAME]
  password: [PASSWORD]

The DSN is configured elsewhere, but it is in nowhere as complex as yours. I followed these instructions: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Platform-Installation---Ubuntu

0

精彩评论

暂无评论...
验证码 换一张
取 消