Setting up Rails to work with sqlserver

后端 未结 6 1633
孤城傲影
孤城傲影 2020-12-31 08:15

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.

Contents of database.yml

6条回答
  •  Happy的楠姐
    2020-12-31 08:38

    I used and ODBC data source and the SQL Server adapter on Windows Server 2008 against SQL Server 2000 running on a remote instance.

    Install SQL Server Adapter

    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

    • Type: SQL Server
    • Name: rails_development
    • Description: rails_development
    • Server: SERVER
    • SQL Authentication (sa/12345)
    • Default Database: DATABASE

    Setup database.yml

    development:
        adapter: sqlserver
        mode: odbc
        dsn: rails_development
        username: sa
        password: 12345
    

    YMMV

    A couple of helpful links:

    • http://rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
    • http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas

提交回复
热议问题