Ruby on Rails和MS SQL EXPRESS
我想开发一个使用MS SQL Express的RoR应用程序,但我无法弄清楚如何连接到数据库。我试图Ruby on Rails和MS SQL EXPRESS
development:
adapter: sqlserver
database: historicDB
username: dxt
password: dxt
host: DBI:ADO:Provider=SQLNCLI;Data Source=localhost\SQLEXPRESS;InitialCatalog=historicDB;User Id=dxt;Password=dxt;
和
development:
adapter: sqlserver
database: historicDB
host: localhost\SQLEXPRESSS
username: dxt
password: dxt
我也装DBI,DBD-ODBC,ActiveRecord的 - SQLSERVER适配器,但nowthing作品我总是
ActiveRecord::ConnectionNotEstablished
在欢迎屏幕上
我没有使用这个与上面显示的完全相同的配置,但是这个链接可能有所帮助:http://rob-rowe.blogspot.com/2010/10/getting-rails-3-up-on-windows.html
你是如何设法安装Development Kid的?我运行红宝石dk.rb init,它发现我的安装目录,然后我运行红宝石dk.rb安装,它看起来它安装,但当我尝试安装任何东西我得到一个错误,需要构建工具没有安装 – 2011-03-03 14:13:54
我遵循这些指示:https://github.com/oneclick/rubyinstaller/wiki/Development-Kit专门的第4部分。在我这样做后,我能够得到它的工作。 – Rob 2011-03-03 14:38:35
我做了同样的事情,但第5部分失败 – 2011-03-03 15:17:21
在旧文档中,您将找到关于使用dbi和dbi-odbc的信息,但这些都已过时。
技术的当前状态,使用SQLSERVER适配器与TinyTds:
你会发现相关信息如何设置在这里: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki
我设法通过所有的步骤(的devkit,ODBC DSN ..)来获得,但最终我还是得到的ActiveRecord :: ConnectionNotEstablished – 2011-03-03 17:14:01
首先,使用TinyTDS宝石及使用咨询本页面命名实例。 https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds
你应该能够做到这一点:
development:
adapter: sqlserver
database: historicDB
dataserver: localhost\SQLEXPRESSS
username: dxt
password: dxt
我不明白,从维基。它让我觉得如果我需要使用命名实例,我必须在freetds.conf文件中指定它。我当时正在努力寻找创造它的地方。这更有意义。很高兴我找到了它。 – 2014-07-18 11:42:59
我必须将'localhost:1433 \ SQLEXPRESS'作为'port:'属性不起作用 – 2017-02-10 22:51:47
http://stackoverflow.com/questions/67141/using-rails-2-x-with-ms-sql-server-2005 – 2011-03-03 13:27:41