开发者

activerecord-sqlserver-adapter

开发者 https://www.devze.com 2023-02-20 10:41 出处:网络
I am trying to connect to SQL Server from a Ruby on Rails Application. I installed the gem activerecord-sqlserver-adapter and realized from tutorials that I will need a DSN in order to connect to it.

I am trying to connect to SQL Server from a Ruby on Rails Application.

I installed the gem activerecord-sqlserver-adapter and realized from tutorials that I will need a DSN in order to connect to it.

I have 3 questions;

  1. Do I need to install the gem ruby-odbc in order for this sqlserver gem to work?
  2. Are there any alternative ways of connecting to the db without using a DSN?
  3. Can I do scaffolding with RoR and 开发者_JAVA技巧SQL Server?

Thanks.


You really should be using TinyTDS (not ODBC) to connect to SQL Server. Have you looked at the project page on github and what they recommend on the wiki?

We even bundle prebuilt native gems for windows so they do not have to install FreeTDS too.


To answer your question:

  1. The sql-adapter is part of the Rails installation.
  2. There might be, but why not use dsn unless you can't
  3. Can't help you there, but if you use ActiveRecord as a base class, the contents of the database datastream are inferred from the metadata returned from the database.

See my response to the following question for some setup help:

Add SQL 2014 support to activerecord-sqlserver-adapter

0

精彩评论

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