Problems Connecting to SQL Server

Hi all

I want to connect my app to MSSQL but when i type

rake db:migrate

an erro occured like this:

←[31mCould not find gem 'odbc (>= 0, runtime)' in any of the gem sources listed in your Gemfile.←[0m

this is my YML file:

development:   adapter: sqlserver   mode: odbc   dsn: ontrack   host: BABAK-PC   pool: 5   timeout: 5000

and in my gem file

gem 'activerecord-sqlserver-adapter' gem 'odbc'

Thnk you for your help

Hi all I want to connect my app to MSSQL but when i type

rake db:migrate

an erro occured like this:

←[31mCould not find gem ‘odbc (>= 0, runtime)’ in any of the gem sources listed in your Gemfile.←[0m

The error message is your answer. There is no “odbc” gem (at least, not hosted on any of the sources which I’m guessing is just the default of :rubygems for you). You can verify that rubygems.org doesn’t have a gem named “odbc” by visiting http://www.rubygems.org/ and doing a search for “odbc”.

You’ll get several resulting gems, but none of the gems are named (exactly) “odbc”.

The “Installation” section of the README.rdoc file from the activerecord-sqlserver-adapter gem (GitHub - rails-sqlserver/activerecord-sqlserver-adapter: SQL Server Adapter For Rails) says that you need “Ruby ODBC”. This would be the “ruby-odbc” gem (ruby-odbc | RubyGems.org | your community gem host ; try “ruby-odbc” in your Gemfile).

Kendall Gifford wrote in post #1000466:

Have you checked that user XXX/XXX can login to the server via an alternative client? It seems an obvious thing to check, but you have not told us that you have checked so the question has to be asked.

Colin

Colin Law wrote in post #1000728:

Have you checked that user XXX/XXX can login to the server via an alternative client?

What you means? Excuse me I am Beginner :frowning: could you please give me an example?

He means go use a tool that comes with SQL server or any other tool out there for connecting to databases and try to connect to you database. The error you got is pretty clear, you have the wrong user id and/or password. If you got this id and password from someone else (like a DBA) go back to that person and make sure they gave you a correct one.

B.

Bryan Crossland wrote in post #1000783:

Just in case you did not realise, you should specify the user and password in config/database.yml

Colin

Colin Law wrote in post #1001026:

No idea, sorry, I think you will have to talk to your system admin guy or someone who knows about MSSQL server or perhaps ODBC. I don't think It is a rails issue. Perhaps your NT user/password will work.

Colin

Hi Colin,

try including: "integrated_security: true' in the YML file. (and eliminate user and password)

in the link:

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter

In the IronRuby section, it is mentioning that issue.

Regards,

Eduardo Blumenfeld

Eduardo Blumenfeld wrote in post #1001093:

Hi Colin,

try including: "integrated_security: true' in the YML file. (and eliminate user and password)

in the link:

GitHub - rails-sqlserver/activerecord-sqlserver-adapter: SQL Server Adapter For Rails

In the IronRuby section, it is mentioning that issue.

Regards,

Eduardo Blumenfeld

Hi Eduardo

Yesssssssssss,That's it.That problem has been solved :slight_smile: Should i change Test and Protection block in my YML file?I'm facing another Error about these two blocks Thank you so much