由于某些SQL Server配置错误,无法启动rails服务器

时间:2015-04-23 03:53:57

标签: ruby sql-server ruby-on-rails-3

尝试启动rails服务器时出现以下错误"" rails server"在cmd。

  

错误:

Exiting
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.13/lib/ac
tive_record/connection_adapters/sqlserver_adapter.rb:440:in `execute': closed co
nnection (TinyTds::Error)

以下是我的Gem和database.yml文件。

  

database.yml中:

# MySQL.  Versions 4.1 and 5.0 are recommended.
# 
# Install the MYSQL driver
#   gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
#   gem 'mysql2'
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: sqlserver
  mode: dblib
  encoding: utf8
  reconnect: false
  database: Swargadwara_puri
  pool: 5
  username: sa 
  password: chandra123
  dataserver: OWL002\SQL2012

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlserver
  mode: dblib
  encoding: utf8
  reconnect: false
  database: Swargadwara_puri
  pool: 5
  username: sa
  password: chandra123
  dataserver: OWL002\SQL2012

production:
  adapter: sqlserver
  mode: dblib
  encoding: utf8
  reconnect: false
  database: Swargadwara_puri
  pool: 5
  username: sa
  password: chandra123
  dataserver: OWL002\SQL2012
  

的Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.19'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

#gem 'mysql'
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
gem "bcrypt-ruby", :require => "bcrypt"
# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
gem 'bootstrap-datepicker-rails', '>= 0.6.21'
gem 'will_paginate', '~> 3.0'

我的SQL服务器配置详细信息如下所述。

我还在sql配置中启用了TCP / IP。请帮我解决此错误并使用rails设置SQL服务器。

0 个答案:

没有答案