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

Kendall G. wrote in post #1000466:

On Sunday, May 22, 2011 11:51:23 AM UTC-6, Ruby-Forum.com User wrote:

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
(https://github.com/rails-sqlserver/activerecord-sqlserver-adapter) says
that you need “Ruby ODBC”. This would be the “ruby-odbc” gem
(http://rubygems.org/gems/ruby-odbc ; try “ruby-odbc” in your Gemfile).

Thank you Kendll,i think my problem has been solved but i am facing
another problem in connecting to my sql server. another error is:

28000 (18456) [Microsoft][ODBC SQL Server Driver][SQL Server]Login
failed for user XXX/XXX

what should i do?would you please help me?

On Sunday, May 22, 2011 11:51:23 AM UTC-6, Ruby-Forum.com User wrote:

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
(https://github.com/rails-sqlserver/activerecord-sqlserver-adapter) says
that you need “Ruby ODBC”. This would be the “ruby-odbc” gem
(http://rubygems.org/gems/ruby-odbc ; try “ruby-odbc” in your Gemfile).

On 24 May 2011 21:49, Babak bsn [email protected] wrote:

You’ll get several resulting gems, but none of the gems are named
another problem in connecting to my sql server. another error is:

28000 (18456) [Microsoft][ODBC SQL Server Driver][SQL Server]Login
failed for user XXX/XXX

what should i do?would you please help me?

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 L. 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?

On Tue, May 24, 2011 at 4:12 PM, Babak bsn [email protected] wrote:

Colin L. 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 C. wrote in post #1000783:

On Tue, May 24, 2011 at 4:12 PM, Babak bsn [email protected] wrote:

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.

Thank you Bryan,now i understand , i checked my Connection string to SQL
Server on another programm and there i did not need to connect via
username and passwort but
i dont know i need to enter Username and passwort

On 25 May 2011 19:47, Babak bsn [email protected] wrote:

that person and make sure they gave you a correct one.

B.

Thank you Bryan,now i understand , i checked my Connection string to SQL
Server and there i did not need to connect via username and passwort but
i dont know i need to enter Username and passwort

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

Colin

Colin L. wrote in post #1001026:

On 25 May 2011 19:47, Babak bsn [email protected] wrote:

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

Colin

Hi Colin

Which username and password?
i used Windows NT authentication to connect to SQL in my odbc

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 B.

Eduardo B. wrote in post #1001093:

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 B.

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

On 25 May 2011 21:46, Babak bsn [email protected] wrote:

Which username and password?
i used Windows NT authentication to connect to SQL in my odbc

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs