Ok I followed the steps for setting up ruby and rails on my Vista machine and I am having a problem connecting to the database.
好的,我按照在Vista机器上设置ruby和rails的步骤进行了操作,但是我在连接数据库时遇到了问题。
Contents of database.yml
development:
adapter: sqlserver
database: APPS_SETUP
Host: WindowsVT06\SQLEXPRESS
Username: se
Password: paswd
Run rake db:migrate
from myapp directory
运行rake db:从myapp目录迁移
----------
rake aborted!
no such file to load -- deprecated
ADO
I have dbi 0.4.0 installed and have created the ADO folder in
我已经安装了dbi 0.4.0,并在其中创建了ADO文件夹
C:\Ruby\lib\ruby\site_ruby\1.8\DBD\ADO
C:\ Ruby \ lib \ Ruby \ site_ruby \ 1.8 \ DBD \ ADO
I got the ado.rb from the dbi 0.2.2
我得到了ado。rb来自dbi 0.2.2
What else should I be looking at to fix the issue connecting to the database? Please don't tell me to use MySql or Sqlite or Postgres.
要修复连接到数据库的问题,我还需要查看什么?请不要告诉我使用MySql或Sqlite或Postgres。
****UPDATE****
* * * * * * * *更新
I have installed the activerecord-sqlserver-adapter gem from --source=http://gems.rubyonrails.org
我已经安装了activerecord-sqlserver-adapter gem—source=http://gems.rubyonrails.org
Still not working.
仍然不工作。
I have verified that I can connect to the database by logging into SQL Management Studio with the credentials.
我已经验证了我可以通过使用凭据登录到SQL Management Studio来连接数据库。
rake db:migrate --trace
rake db:migrate,跟踪
PS C:\Inetpub\wwwroot\myapp> rake db:migrate --trace
(in C:/Inetpub/wwwroot/myapp)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
no such file to load -- deprecated
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:48
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/requires.rb:7:in `require_library_
or_gem'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnin
gs'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_
or_gem'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0.9250/lib/active_record/connection_adapters/sqlserver
_adapter.rb:29:in `sqlserver_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:292:in `send'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:292:in `connection='
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:260:in `retrieve_connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/connection_specificatio
n.rb:78:in `connection'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:408:in `initialize'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:373:in `new'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:373:in `up'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:356:in `migrate'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/tasks/databases.rake:99
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in `execute'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:582:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:575:in `invoke_with_call_chain'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:568:in `invoke'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2031:in `invoke_task'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2003:in `top_level'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1982:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1979:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
PS C:\Inetpub\wwwroot\myapp>
6 个解决方案
#1
5
I ran into the same problem yesterday. Apparently 'deprecated' is a gem, so you want to run "gem install deprecated" to grab and install the latest version. Good luck.
我昨天遇到了同样的问题。显然,“已弃用”是一个gem,因此您需要运行“已弃用的gem安装”来获取并安装最新的版本。祝你好运。
#2
3
I used and ODBC data source and the SQL Server adapter on Windows Server 2008 against SQL Server 2000 running on a remote instance.
我使用了Windows Server 2008上的ODBC数据源和SQL Server适配器,而SQL Server 2000在远程实例上运行。
Install SQL Server Adapter
安装SQL Server适配器
gem.bat install activerecord-sqlserver-adapter
Successfully installed deprecated-2.0.1
Successfully installed dbi-0.4.1
Successfully installed dbd-odbc-0.2.4
Successfully installed activerecord-sqlserver-adapter-2.2.22
4 gems installed
Create an ODBC datasource
创建一个ODBC数据源
- Type: SQL Server
- 类型:SQL Server
- Name: rails_development
- 名称:rails_development
- Description: rails_development
- 描述:rails_development
- Server: SERVER
- 服务器:服务器
- SQL Authentication (sa/12345)
- SQL验证(sa / 12345)
- Default Database: DATABASE
- 默认数据库:数据库
Setup database.yml
设置的形式
development:
adapter: sqlserver
mode: odbc
dsn: rails_development
username: sa
password: 12345
YMMV
YMMV
A couple of helpful links:
一些有用的链接:
- http://rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
- http://rubyrailsandwindows.blogspot.com/2008/03/rails - 2和- sql - server - 2008 - windows_24.html
- http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas
- http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas
#3
2
Did you install the SQL Server adapter?
您安装SQL服务器适配器了吗?
gem install activerecord-sqlserver-adapter --source=http://gems.rubyonrails.org
#4
2
If you're on a 64 bit machine, there are two ODBC administrator programs, one for 32 bit and one for 64 bit. activerecord-sqlserver-adapter looks for DSNs set up with the 32 bit version.
如果在64位机器上,有两个ODBC管理程序,一个用于32位,另一个用于64位。activerecord-sqlserver-adapter查找使用32位版本设置的DSNs。
#5
1
Correct link is http://rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
正确的链接http://rubyrailsandwindows.blogspot.com/2008/03/rails - 2和- sql - server - 2008 - windows_24.html
#6
0
I too had faced this problem. There is another work around. You can create a DSN for the app db from control panel->admin tools->Odbc. Database.yml file should look like below:
我也遇到过这个问题。还有另外一项工作。您可以从控制面板——>管理工具——>Odbc为应用程序db创建一个DSN。数据库。yml文件应该如下所示:
adapter: sqlserver
mode: odbc
dsn: DSN_NAME
host: localhost
database: App_development
username: uname
password: password
I tried using the deprecated gem, wasn't of much use. I had tried installing an ADO adaptor too which rendered useless.
我试着使用这个废弃的gem,但是没有什么用。我也试过安装一个ADO适配器,但这对我来说毫无用处。
#1
5
I ran into the same problem yesterday. Apparently 'deprecated' is a gem, so you want to run "gem install deprecated" to grab and install the latest version. Good luck.
我昨天遇到了同样的问题。显然,“已弃用”是一个gem,因此您需要运行“已弃用的gem安装”来获取并安装最新的版本。祝你好运。
#2
3
I used and ODBC data source and the SQL Server adapter on Windows Server 2008 against SQL Server 2000 running on a remote instance.
我使用了Windows Server 2008上的ODBC数据源和SQL Server适配器,而SQL Server 2000在远程实例上运行。
Install SQL Server Adapter
安装SQL Server适配器
gem.bat install activerecord-sqlserver-adapter
Successfully installed deprecated-2.0.1
Successfully installed dbi-0.4.1
Successfully installed dbd-odbc-0.2.4
Successfully installed activerecord-sqlserver-adapter-2.2.22
4 gems installed
Create an ODBC datasource
创建一个ODBC数据源
- Type: SQL Server
- 类型:SQL Server
- Name: rails_development
- 名称:rails_development
- Description: rails_development
- 描述:rails_development
- Server: SERVER
- 服务器:服务器
- SQL Authentication (sa/12345)
- SQL验证(sa / 12345)
- Default Database: DATABASE
- 默认数据库:数据库
Setup database.yml
设置的形式
development:
adapter: sqlserver
mode: odbc
dsn: rails_development
username: sa
password: 12345
YMMV
YMMV
A couple of helpful links:
一些有用的链接:
- http://rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
- http://rubyrailsandwindows.blogspot.com/2008/03/rails - 2和- sql - server - 2008 - windows_24.html
- http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas
- http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas
#3
2
Did you install the SQL Server adapter?
您安装SQL服务器适配器了吗?
gem install activerecord-sqlserver-adapter --source=http://gems.rubyonrails.org
#4
2
If you're on a 64 bit machine, there are two ODBC administrator programs, one for 32 bit and one for 64 bit. activerecord-sqlserver-adapter looks for DSNs set up with the 32 bit version.
如果在64位机器上,有两个ODBC管理程序,一个用于32位,另一个用于64位。activerecord-sqlserver-adapter查找使用32位版本设置的DSNs。
#5
1
Correct link is http://rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
正确的链接http://rubyrailsandwindows.blogspot.com/2008/03/rails - 2和- sql - server - 2008 - windows_24.html
#6
0
I too had faced this problem. There is another work around. You can create a DSN for the app db from control panel->admin tools->Odbc. Database.yml file should look like below:
我也遇到过这个问题。还有另外一项工作。您可以从控制面板——>管理工具——>Odbc为应用程序db创建一个DSN。数据库。yml文件应该如下所示:
adapter: sqlserver
mode: odbc
dsn: DSN_NAME
host: localhost
database: App_development
username: uname
password: password
I tried using the deprecated gem, wasn't of much use. I had tried installing an ADO adaptor too which rendered useless.
我试着使用这个废弃的gem,但是没有什么用。我也试过安装一个ADO适配器,但这对我来说毫无用处。